diff options
Diffstat (limited to 'skia/ext/platform_device_mac.cc')
-rw-r--r-- | skia/ext/platform_device_mac.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/skia/ext/platform_device_mac.cc b/skia/ext/platform_device_mac.cc index ae9228e..42927cc 100644 --- a/skia/ext/platform_device_mac.cc +++ b/skia/ext/platform_device_mac.cc @@ -128,10 +128,18 @@ void PlatformDevice::LoadClippingRegionToCGContext( rect.setEmpty(); CGContextClipToRect(context, gfx::SkRectToCGRect(rect)); } else if (region.isRect()) { + // CoreGraphics applies the current transform to clip rects, which is + // unwanted. Inverse-transform the rect before sending it to CG. This only + // works for translations and scaling, but not for rotations (but the + // viewport is never rotated anyway). + SkMatrix t; + bool did_invert = transformation.invert(&t); + if (!did_invert) + t.reset(); // Do the transformation. SkRect rect; rect.set(region.getBounds()); - transformation.mapRect(&rect); + t.mapRect(&rect); SkIRect irect; rect.round(&irect); CGContextClipToRect(context, gfx::SkIRectToCGRect(irect)); |