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

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: 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
Index: skia/ext/platform_canvas.cc
diff --git a/skia/ext/platform_canvas.cc b/skia/ext/platform_canvas.cc
index f06d30cf7afc9d203611918aab32dd493a9e346e..5c57a6e42b2bf978e5e6410063714736ca739c38 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,18 @@ 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();
+}
+
+ScopedPlatformPaint::~ScopedPlatformPaint() { }
+
+PlatformSurface ScopedPlatformPaint::GetPlatformSurface() { return platform_surface_; }
+
+
} // namespace skia

Powered by Google App Engine
This is Rietveld 408576698