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

Unified Diff: skia/ext/platform_canvas.cc

Issue 1963713002: Replace setMatrixClip() with BeginPlatformPaint() logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compensate for any outstanding saveLayer() calls Created 4 years, 7 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.h ('k') | skia/ext/platform_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/platform_canvas.cc
diff --git a/skia/ext/platform_canvas.cc b/skia/ext/platform_canvas.cc
index dfd8e8f8a65128a004b7c489370475d407ef409d..7f0b8ab08a1735de806676b9edc0f7b3b7ccdd8b 100644
--- a/skia/ext/platform_canvas.cc
+++ b/skia/ext/platform_canvas.cc
@@ -97,7 +97,11 @@ bool IsPreviewMetafile(const SkCanvas& canvas) {
CGContextRef GetBitmapContext(const SkCanvas& canvas) {
SkBaseDevice* device = GetTopDevice(canvas);
PlatformDevice* platform_device = GetPlatformDevice(device);
- return platform_device ? platform_device->GetBitmapContext() :
+ SkIRect clip_bounds;
+ canvas.getClipDeviceBounds(&clip_bounds);
+ return platform_device ?
+ platform_device->GetBitmapContext(
+ canvas.getTotalMatrix(), clip_bounds) :
nullptr;
}
@@ -106,9 +110,15 @@ CGContextRef GetBitmapContext(const SkCanvas& canvas) {
ScopedPlatformPaint::ScopedPlatformPaint(SkCanvas* canvas) :
canvas_(canvas),
platform_surface_(nullptr) {
+ // TODO(tomhudson) we're assuming non-null canvas?
PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
- if (platform_device)
- platform_surface_ = platform_device->BeginPlatformPaint();
+ if (platform_device) {
+ // Compensate for drawing to a layer rather than the entire canvas
+ SkMatrix ctm;
+ SkIRect clip_bounds;
+ canvas->temporary_internal_describeTopLayer(&ctm, &clip_bounds);
+ platform_surface_ = platform_device->BeginPlatformPaint(ctm, clip_bounds);
+ }
}
} // namespace skia
« no previous file with comments | « skia/ext/platform_canvas.h ('k') | skia/ext/platform_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698