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_ |