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 |