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

Unified Diff: skia/ext/bitmap_platform_device_mac.cc

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/bitmap_platform_device_mac.cc
===================================================================
--- skia/ext/bitmap_platform_device_mac.cc (revision 123041)
+++ skia/ext/bitmap_platform_device_mac.cc (working copy)
@@ -113,7 +113,7 @@
BitmapPlatformDevice* BitmapPlatformDevice::Create(CGContextRef context,
int width,
int height,
- bool is_opaque) {
+ int flags) {
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
if (bitmap.allocPixels() != true)
@@ -129,14 +129,15 @@
// Note: The Windows implementation clears the Bitmap later on.
// This bears mentioning since removal of this line makes the
// unit tests only fail periodically (or when MallocPreScribble is set).
- bitmap.eraseARGB(0, 0, 0, 0);
+ if (flags & FLAGS_INITIALIZED)
+ bitmap.eraseARGB(0, 0, 0, 0);
}
- bitmap.setIsOpaque(is_opaque);
+ bitmap.setIsOpaque(flags & FLAGS_OPAQUE);
// If we were given data, then don't clobber it!
#ifndef NDEBUG
- if (!context && is_opaque) {
+ if (!context && (flags & FLAGS_OPAQUE)) {
// To aid in finding bugs, we set the background color to something
// obviously wrong so it will be noticable when it is not cleared
bitmap.eraseARGB(255, 0, 255, 128); // bright bluish green
@@ -163,12 +164,12 @@
BitmapPlatformDevice* BitmapPlatformDevice::CreateWithData(uint8_t* data,
int width,
int height,
- bool is_opaque) {
+ int flags) {
CGContextRef context = NULL;
if (data)
context = CGContextForData(data, width, height);
- BitmapPlatformDevice* rv = Create(context, width, height, is_opaque);
+ BitmapPlatformDevice* rv = Create(context, width, height, flags);
// The device object took ownership of the graphics context with its own
// CGContextRetain call.
@@ -242,7 +243,8 @@
SkBitmap::Config config, int width, int height, bool isOpaque,
Usage /*usage*/) {
SkASSERT(config == SkBitmap::kARGB_8888_Config);
- return BitmapPlatformDevice::Create(NULL, width, height, isOpaque);
+ return BitmapPlatformDevice::Create(NULL, width, height,
+ GetDefaultFlags(isOpaque));
}
} // namespace skia

Powered by Google App Engine
This is Rietveld 408576698