From 87ef8484fbd915ac4e527fb566422002f4d612ab Mon Sep 17 00:00:00 2001 From: "mad@google.com" Date: Wed, 10 Jun 2009 21:41:54 +0000 Subject: To help resolve the performance issue introduced when enabling the resize corner, we now keep all non-intersecting rects separately and send an array of invalidation bitmaps via IPC as opposed to a single unionized rect :-) Review URL: http://codereview.chromium.org/108040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18090 0039d316-1c4b-4281-b951-d872f2087c98 --- skia/ext/bitmap_platform_device_mac.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'skia') diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc index 668f4f0..41458c1 100644 --- a/skia/ext/bitmap_platform_device_mac.cc +++ b/skia/ext/bitmap_platform_device_mac.cc @@ -114,6 +114,9 @@ BitmapPlatformDeviceMac::\ clip_region_ = SkRegion(rect); transform_.reset(); CGContextRetain(bitmap_context_); + // We must save the state once so that we can use the restore/save trick + // in LoadConfig(). + CGContextSaveGState(bitmap_context_); } void BitmapPlatformDeviceMac::BitmapPlatformDeviceMacData::SetMatrixClip( @@ -131,6 +134,15 @@ void BitmapPlatformDeviceMac::BitmapPlatformDeviceMacData::LoadConfig() { // Transform. SkMatrix t(transform_); + + // We must restore and then save the state of the graphics context since the + // calls to Load the clipping region to the context are strictly cummulative, + // i.e., you can't replace a clip rect, other than with a save/restore. + // But this implies that no other changes to the state are done elsewhere. + // If we ever get to need to change this, then we must replace the clip rect + // calls in LoadClippingRegionToCGContext() with an image mask instead. + CGContextRestoreGState(bitmap_context_); + CGContextSaveGState(bitmap_context_); LoadTransformToCGContext(bitmap_context_, t); t.setTranslateX(-t.getTranslateX()); t.setTranslateY(-t.getTranslateY()); -- cgit v1.1