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

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
« no previous file with comments | « skia/ext/bitmap_platform_device_win.cc ('k') | skia/ext/platform_canvas.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/platform_canvas.h
===================================================================
--- skia/ext/platform_canvas.h (revision 161107)
+++ skia/ext/platform_canvas.h (working copy)
@@ -7,6 +7,7 @@
// The platform-specific device will include the necessary platform headers
// to get the surface type.
+#include "base/basictypes.h"
#include "skia/ext/platform_device.h"
#include "third_party/skia/include/core/SkCanvas.h"
@@ -151,6 +152,28 @@
ScopedPlatformPaint& operator=(const ScopedPlatformPaint&);
};
+class SK_API PlatformBitmap {
+ public:
+ PlatformBitmap();
+ ~PlatformBitmap();
+
+ // Returns true if the bitmap was able to allocate its surface.
+ bool Allocate(int width, int height, bool is_opaque);
+
+ // Returns the platform surface, or 0 if Allocate() did not return true.
+ PlatformSurface GetSurface() { return surface_; }
+
+ // Return the skia bitmap, which will be empty if Allocate() did not
+ // return true.
+ const SkBitmap& GetBitmap() { return bitmap_; }
+
+ private:
+ SkBitmap bitmap_;
+ PlatformSurface surface_;
+
+ DISALLOW_COPY_AND_ASSIGN(PlatformBitmap);
+};
+
} // namespace skia
#endif // SKIA_EXT_PLATFORM_CANVAS_H_
« no previous file with comments | « skia/ext/bitmap_platform_device_win.cc ('k') | skia/ext/platform_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698