Index: skia/ext/bitmap_platform_device_win.cc |
=================================================================== |
--- skia/ext/bitmap_platform_device_win.cc (revision 126621) |
+++ skia/ext/bitmap_platform_device_win.cc (working copy) |
@@ -87,7 +87,7 @@ |
// that we can create the pixel data before calling the constructor. This is |
// required so that we can call the base class' constructor with the pixel |
// data. |
-BitmapPlatformDevice* BitmapPlatformDevice::create( |
+BitmapPlatformDevice* BitmapPlatformDevice::Create( |
HDC screen_dc, |
int width, |
int height, |
@@ -136,8 +136,6 @@ |
// obviously wrong so it will be noticable when it is not cleared |
bitmap.eraseARGB(255, 0, 255, 128); // bright bluish green |
#endif |
- } else { |
- bitmap.eraseARGB(0, 0, 0, 0); |
} |
} |
@@ -148,17 +146,34 @@ |
} |
// static |
-BitmapPlatformDevice* BitmapPlatformDevice::create(int width, |
+BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, |
int height, |
bool is_opaque, |
HANDLE shared_section) { |
HDC screen_dc = GetDC(NULL); |
- BitmapPlatformDevice* device = BitmapPlatformDevice::create( |
+ BitmapPlatformDevice* device = BitmapPlatformDevice::Create( |
screen_dc, width, height, is_opaque, shared_section); |
ReleaseDC(NULL, screen_dc); |
return device; |
} |
+// 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 (!is_opaque) |
+ device->accessBitmap(true).eraseARGB(0, 0, 0, 0); |
+ return device; |
+} |
+ |
// The device will own the HBITMAP, which corresponds to also owning the pixel |
// data. Therefore, we do not transfer ownership to the SkDevice's bitmap. |
BitmapPlatformDevice::BitmapPlatformDevice( |
@@ -259,7 +274,9 @@ |
SkBitmap::Config config, int width, int height, bool isOpaque, |
Usage /*usage*/) { |
SkASSERT(config == SkBitmap::kARGB_8888_Config); |
- return BitmapPlatformDevice::create(width, height, isOpaque, NULL); |
+ SkDevice* bitmap_device = BitmapPlatformDevice::CreateAndClear(width, height, |
+ isOpaque); |
+ return bitmap_device; |
} |
} // namespace skia |