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

Unified Diff: skia/ext/bitmap_platform_device_win.cc

Issue 773373002: Update from https://crrev.com/306706 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « skia/ext/bitmap_platform_device_win.h ('k') | third_party/boringssl/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « skia/ext/bitmap_platform_device_win.h ('k') | third_party/boringssl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698