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

Unified Diff: skia/ext/platform_canvas.h

Issue 9416017: Optionally clear PlatformCanvas instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Address style issues. Created 8 years, 10 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 123041)
+++ skia/ext/platform_canvas.h (working copy)
@@ -20,25 +20,25 @@
public:
// If you use the version with no arguments, you MUST call initialize()
PlatformCanvas();
- // Set is_opaque if you are going to erase the bitmap and not use
+ // Set flags to FLAGS_OPAQUE if you are going to erase the bitmap and not use
// transparency: this will enable some optimizations.
- PlatformCanvas(int width, int height, bool is_opaque);
+ // Set flags to FLAGS_INITIALIZED if the canvas should be initialized to 0.
+ PlatformCanvas(int width, int height, int flags);
#if defined(WIN32)
// The shared_section parameter is passed to gfx::PlatformDevice::create.
// See it for details.
- PlatformCanvas(int width, int height, bool is_opaque, HANDLE shared_section);
+ PlatformCanvas(int width, int height, int flags, HANDLE shared_section);
#elif defined(__APPLE__)
- PlatformCanvas(int width, int height, bool is_opaque,
- CGContextRef context);
- PlatformCanvas(int width, int height, bool is_opaque, uint8_t* context);
+ PlatformCanvas(int width, int height, int flags, CGContextRef context);
+ PlatformCanvas(int width, int height, int flags, uint8_t* context);
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
defined(__sun) || defined(ANDROID)
// Linux ---------------------------------------------------------------------
// Construct a canvas from the given memory region. The memory is not cleared
// first. @data must be, at least, @height * StrideForWidth(@width) bytes.
- PlatformCanvas(int width, int height, bool is_opaque, uint8_t* data);
+ PlatformCanvas(int width, int height, int flags, uint8_t* data);
#endif
virtual ~PlatformCanvas();
@@ -47,17 +47,17 @@
// For two-part init, call if you use the no-argument constructor above. Note
// that we want this to optionally match the Linux initialize if you only
// pass 3 arguments, hence the evil default argument.
- bool initialize(int width, int height, bool is_opaque,
+ bool initialize(int width, int height, int flags,
HANDLE shared_section = NULL);
#elif defined(__APPLE__)
// For two-part init, call if you use the no-argument constructor above
- bool initialize(CGContextRef context, int width, int height, bool is_opaque);
- bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL);
+ bool initialize(CGContextRef context, int width, int height, int flags);
+ bool initialize(int width, int height, int flags, uint8_t* data = NULL);
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
defined(__sun) || defined(ANDROID)
// For two-part init, call if you use the no-argument constructor above
- bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL);
+ bool initialize(int width, int height, int flags, uint8_t* data = NULL);
#endif
// Shared --------------------------------------------------------------------
@@ -109,12 +109,19 @@
// transparency: this will enable some optimizations.
SK_API SkCanvas* CreateBitmapCanvas(int width, int height, bool is_opaque);
+// Creates a canvas with raster bitmap backing.
+// Set flags to FLAGS_OPAQUE if you are going to erase the bitmap and not use
+// transparency: this will enable some optimizations.
+// Set flags to FLAGS_INITIALIZED if the canvas should be initialized to 0.
+SK_API SkCanvas* CreateBitmapCanvas(int width, int height, int flags);
+
// Non-crashing version of CreateBitmapCanvas
// returns NULL if allocation fails for any reason.
// Use this instead of CreateBitmapCanvas in places that are likely to
// attempt to allocate very large canvases (therefore likely to fail),
// and where it is possible to recover gracefully from the failed allocation.
SK_API SkCanvas* TryCreateBitmapCanvas(int width, int height, bool is_opaque);
+SK_API SkCanvas* TryCreateBitmapCanvas(int width, int height, int flags);
// Returns true if native platform routines can be used to draw on the
// given canvas. If this function returns false, BeginPlatformPaint will

Powered by Google App Engine
This is Rietveld 408576698