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

Unified Diff: skia/ext/platform_device_win.cc

Issue 75020: Make non-rectangular clip region apply in the correct location.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | « skia/ext/platform_canvas_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/platform_device_win.cc
===================================================================
--- skia/ext/platform_device_win.cc (revision 13611)
+++ skia/ext/platform_device_win.cc (working copy)
@@ -200,20 +200,21 @@
// region can be empty, in which case everything will be clipped.
hrgn = CreateRectRgn(0, 0, 0, 0);
} else if (region.isRect()) {
- // Do the transformation.
- SkRect rect;
- rect.set(region.getBounds());
- transformation.mapRect(&rect);
- SkIRect irect;
- rect.round(&irect);
- hrgn = CreateRectRgnIndirect(&SkIRectToRECT(irect));
+ // We don't apply transformation, because the translation is already applied
+ // to the region.
+ hrgn = CreateRectRgnIndirect(&SkIRectToRECT(region.getBounds()));
} else {
// It is complex.
SkPath path;
region.getBoundaryPath(&path);
// Clip. Note that windows clipping regions are not affected by the
// transform so apply it manually.
- path.transform(transformation);
+ // Since the transform is given as the original translation of canvas, we
+ // should apply it in reverse.
+ SkMatrix t(transformation);
+ t.setTranslateX(-t.getTranslateX());
+ t.setTranslateY(-t.getTranslateY());
+ path.transform(t);
LoadPathToDC(context, path);
hrgn = PathToRegion(context);
}
« no previous file with comments | « skia/ext/platform_canvas_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698