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

Unified Diff: skia/ext/platform_canvas.h

Issue 11031055: Introduce PlatformBitmap, which is a minimal helper class that wraps an SkBitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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
===================================================================
--- skia/ext/platform_canvas.h (revision 160846)
+++ skia/ext/platform_canvas.h (working copy)
@@ -151,6 +151,37 @@
ScopedPlatformPaint& operator=(const ScopedPlatformPaint&);
};
+class SK_API PlatformBitmap {
+public:
brettw 2012/10/09 20:40:12 nit: indenting for these two classes (2 space inde
reed1 2012/10/09 21:06:43 Done.
+ PlatformBitmap() : surface_(0) {}
brettw 2012/10/09 20:40:12 Can you put this in the .cc file? (Background: Chr
reed1 2012/10/09 21:06:43 Done.
+ ~PlatformBitmap();
+
+ bool Allocate(int width, int height, bool isOpaque);
brettw 2012/10/09 20:40:12 style: is_opaque.
+
+ PlatformSurface LockSurface();
brettw 2012/10/09 20:40:12 Can these have documentation? Be sure to mention w
reed1 2012/10/09 21:06:43 Done.
+ void UnlockSurface();
+
+ const SkBitmap& GetBitmap() { return bitmap_; }
+
+private:
+ SkBitmap bitmap_;
brettw 2012/10/09 20:40:12 Normally we don't try to horizontally align these
reed1 2012/10/09 21:06:43 Done.
+ PlatformSurface surface_;
+};
brettw 2012/10/09 20:40:12 Should these classes be DISALLOW_COPY_AND_ASSIGN?
reed1 2012/10/09 21:06:43 That is waht SkNoncopyable does. I have updated Pl
brettw 2012/10/09 21:08:23 If you're doing Chrome code I'd prefer the Chrome
+
+class SK_API ScopedPlatformBitmap : SkNoncopyable {
+public:
+ explicit ScopedPlatformBitmap(PlatformBitmap* bitmap) : bitmap_(bitmap) {
brettw 2012/10/09 20:40:12 Can you also put this constructor & destructor in
+ surface_ = bitmap->LockSurface();
+ }
+ ~ScopedPlatformBitmap() { bitmap_->UnlockSurface(); }
+
+ // Returns the PlatformSurface to use for native platform drawing calls.
+ PlatformSurface GetPlatformSurface() { return surface_; }
+private:
+ PlatformBitmap* bitmap_;
+ PlatformSurface surface_;
+};
brettw 2012/10/09 20:40:12 Probably also DISALLOW_COPY_AND_ASSIGN here.
+
} // namespace skia
#endif // SKIA_EXT_PLATFORM_CANVAS_H_
« skia/ext/bitmap_platform_device_win.cc ('K') | « skia/ext/bitmap_platform_device_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698