Index: skia/ext/skia_utils_mac.mm |
=================================================================== |
--- skia/ext/skia_utils_mac.mm (revision 115549) |
+++ skia/ext/skia_utils_mac.mm (working copy) |
@@ -307,13 +307,13 @@ |
void SkiaBitLocker::releaseIfNeeded() { |
if (!cgContext_) |
return; |
- canvas_->getDevice()->accessBitmap(true).unlockPixels(); |
+ canvas_->getTopDevice()->accessBitmap(true).unlockPixels(); |
CGContextRelease(cgContext_); |
cgContext_ = 0; |
} |
CGContextRef SkiaBitLocker::cgContext() { |
- SkDevice* device = canvas_->getDevice(); |
+ SkDevice* device = canvas_->getTopDevice(); |
DCHECK(device); |
if (!device) |
return 0; |
@@ -334,8 +334,10 @@ |
// Apply clip in device coordinates. |
CGMutablePathRef clipPath = CGPathCreateMutable(); |
SkRegion::Iterator iter(canvas_->getTotalClip()); |
+ const SkIPoint& pt = device->getOrigin(); |
for (; !iter.done(); iter.next()) { |
- const SkIRect& skRect = iter.rect(); |
+ SkIRect skRect = iter.rect(); |
+ skRect.offset(-pt); |
CGRect cgRect = SkIRectToCGRect(skRect); |
CGPathAddRect(clipPath, 0, cgRect); |
} |
@@ -344,7 +346,8 @@ |
CGPathRelease(clipPath); |
// Apply content matrix. |
- const SkMatrix& skMatrix = canvas_->getTotalMatrix(); |
+ SkMatrix skMatrix = canvas_->getTotalMatrix(); |
+ skMatrix.postTranslate(-SkIntToScalar(pt.fX), -SkIntToScalar(pt.fY)); |
CGAffineTransform affine = SkMatrixToCGAffineTransform(skMatrix); |
CGContextConcatCTM(cgContext_, affine); |