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

Unified Diff: skia/ext/platform_canvas.cc

Issue 1839113002: Limit manual control of platform painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Privatize Created 4 years, 9 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 f06d30cf7afc9d203611918aab32dd493a9e346e..72d81f22c269edab1c95d5add242f552eeacd603 100644
--- a/skia/ext/platform_canvas.cc
+++ b/skia/ext/platform_canvas.cc
@@ -65,20 +65,6 @@ bool SupportsPlatformPaint(const SkCanvas* canvas) {
return GetPlatformDevice(GetTopDevice(*canvas)) != nullptr;
}
-PlatformSurface BeginPlatformPaint(SkCanvas* canvas) {
- PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
- if (platform_device)
- return platform_device->BeginPlatformPaint();
-
- return 0;
-}
-
-void EndPlatformPaint(SkCanvas* canvas) {
- PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
- if (platform_device)
- platform_device->EndPlatformPaint();
-}
-
size_t PlatformCanvasStrideForWidth(unsigned width) {
return 4 * width;
}
@@ -116,5 +102,12 @@ CGContextRef GetBitmapContext(const SkCanvas& canvas) {
#endif
+ScopedPlatformPaint::ScopedPlatformPaint(SkCanvas* canvas) :
+ canvas_(canvas),
+ platform_surface_(nullptr) {
+ PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
+ if (platform_device)
+ platform_surface_ = platform_device->BeginPlatformPaint();
+}
} // 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