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

Unified Diff: skia/ext/bitmap_platform_device_win.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_win.cc
===================================================================
--- skia/ext/bitmap_platform_device_win.cc (revision 123041)
+++ skia/ext/bitmap_platform_device_win.cc (working copy)
@@ -91,8 +91,9 @@
HDC screen_dc,
int width,
int height,
- bool is_opaque,
+ int flags,
HANDLE shared_section) {
+
SkBitmap bitmap;
// CreateDIBSection appears to get unhappy if we create an empty bitmap, so
@@ -126,18 +127,19 @@
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
bitmap.setPixels(data);
- bitmap.setIsOpaque(is_opaque);
+ bitmap.setIsOpaque(flags & FLAGS_OPAQUE);
// If we were given data, then don't clobber it!
if (!shared_section) {
- if (is_opaque) {
+ if (flags & FLAGS_OPAQUE) {
#ifndef NDEBUG
// 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
#endif
} else {
- bitmap.eraseARGB(0, 0, 0, 0);
+ if (flags & FLAGS_INITIALIZED)
+ bitmap.eraseARGB(0, 0, 0, 0);
}
}
@@ -150,11 +152,11 @@
// static
BitmapPlatformDevice* BitmapPlatformDevice::create(int width,
int height,
- bool is_opaque,
+ int flags,
HANDLE shared_section) {
HDC screen_dc = GetDC(NULL);
BitmapPlatformDevice* device = BitmapPlatformDevice::create(
- screen_dc, width, height, is_opaque, shared_section);
+ screen_dc, width, height, flags, shared_section);
ReleaseDC(NULL, screen_dc);
return device;
}
@@ -259,7 +261,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);
+ return BitmapPlatformDevice::create(width, height,
+ GetDefaultFlags(isOpaque),
+ NULL);
}
} // namespace skia

Powered by Google App Engine
This is Rietveld 408576698