Index: skia/ext/bitmap_platform_device_win.cc |
diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc |
index 3901ad5f97779e182028de7448a98a6e921b29af..71bb8006534c7349e4ba7733f126fe19b6c58ae9 100644 |
--- a/skia/ext/bitmap_platform_device_win.cc |
+++ b/skia/ext/bitmap_platform_device_win.cc |
@@ -120,7 +120,8 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create( |
int width, |
int height, |
bool is_opaque, |
- HANDLE shared_section) { |
+ HANDLE shared_section, |
+ bool do_clear) { |
void* data; |
HBITMAP hbitmap = CreateHBitmap(width, height, is_opaque, shared_section, |
@@ -132,6 +133,9 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create( |
if (!InstallHBitmapPixels(&bitmap, width, height, is_opaque, data, hbitmap)) |
return NULL; |
+ if (do_clear) |
+ bitmap.eraseColor(0); |
+ |
#ifndef NDEBUG |
// If we were given data, then don't clobber it! |
if (!shared_section && is_opaque) |
@@ -148,18 +152,9 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create( |
// static |
BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, |
bool is_opaque) { |
- return Create(width, height, is_opaque, NULL); |
-} |
- |
-// static |
-BitmapPlatformDevice* BitmapPlatformDevice::CreateAndClear(int width, |
- int height, |
- bool is_opaque) { |
- BitmapPlatformDevice* device = BitmapPlatformDevice::Create(width, height, |
- is_opaque); |
- if (device && !is_opaque) |
- device->clear(0); |
- return device; |
+ const HANDLE shared_section = NULL; |
+ const bool do_clear = false; |
+ return Create(width, height, is_opaque, shared_section, do_clear); |
} |
// The device will own the HBITMAP, which corresponds to also owning the pixel |
@@ -271,11 +266,11 @@ const SkBitmap& BitmapPlatformDevice::onAccessBitmap() { |
} |
SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice( |
- const CreateInfo& info) { |
- SkASSERT(info.fInfo.colorType() == kN32_SkColorType); |
- return BitmapPlatformDevice::CreateAndClear(info.fInfo.width(), |
- info.fInfo.height(), |
- info.fInfo.isOpaque()); |
+ const CreateInfo& cinfo) { |
+ const SkImageInfo& info = cinfo.fInfo; |
+ const bool do_clear = !info.isOpaque(); |
+ SkASSERT(info.colorType() == kN32_SkColorType); |
+ return Create(info.width(), info.height(), info.isOpaque(), NULL, do_clear); |
} |
// PlatformCanvas impl |