Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: skia/ext/skia_utils_mac.mm

Issue 9129001: Adjust the CoreGraphics context for offscreen layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698