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

Unified Diff: skia/ext/platform_canvas.h

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.h
diff --git a/skia/ext/platform_canvas.h b/skia/ext/platform_canvas.h
index 3def7ae3f33df55d35e70d2cc3f3dbe34547a304..f70618539eb37f21370438d09e9e1b58e2eaa1c0 100644
--- a/skia/ext/platform_canvas.h
+++ b/skia/ext/platform_canvas.h
@@ -145,27 +145,17 @@ SK_API bool GetWritablePixels(SkCanvas* canvas, SkPixmap* pixmap);
// return NULL PlatformSurface.
SK_API bool SupportsPlatformPaint(const SkCanvas* canvas);
-// These calls should surround calls to platform drawing routines, the
-// surface returned here can be used with the native platform routines.
-//
-// Call EndPlatformPaint when you are done and want to use skia operations
-// after calling the platform-specific BeginPlatformPaint; this will
-// synchronize the bitmap to OS if necessary.
-SK_API PlatformSurface BeginPlatformPaint(SkCanvas* canvas);
-SK_API void EndPlatformPaint(SkCanvas* canvas);
-
-// Helper class for pairing calls to BeginPlatformPaint and EndPlatformPaint.
-// Upon construction invokes BeginPlatformPaint, and upon destruction invokes
-// EndPlatformPaint.
+// This object guards calls to platform drawing routines. The surface
+// returned from GetPlatformSurface() can be used with the native platform
+// routines.
class SK_API ScopedPlatformPaint {
public:
- explicit ScopedPlatformPaint(SkCanvas* canvas) : canvas_(canvas) {
- platform_surface_ = BeginPlatformPaint(canvas);
- }
- ~ScopedPlatformPaint() { EndPlatformPaint(canvas_); }
+ explicit ScopedPlatformPaint(SkCanvas* canvas);
+ ~ScopedPlatformPaint();
f(malita) 2016/03/29 17:31:08 Nit: dtor no longer needed?
tomhudson 2016/03/29 17:47:32 Done.
// Returns the PlatformSurface to use for native platform drawing calls.
- PlatformSurface GetPlatformSurface() { return platform_surface_; }
+ PlatformSurface GetPlatformSurface();
f(malita) 2016/03/29 17:31:08 Nit: this is trivial enough to keep inline.
tomhudson 2016/03/29 17:47:32 I expect to change this soon enough that I wanted
+
private:
SkCanvas* canvas_;
PlatformSurface platform_surface_;

Powered by Google App Engine
This is Rietveld 408576698