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

Unified Diff: skia/ext/bitmap_platform_device_win.cc

Issue 2158473002: Consolidate Windows bitmap and DC code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review error Created 4 years, 5 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
« no previous file with comments | « no previous file | skia/ext/skia_utils_win.h » ('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 7554f48b24dc83404a0a7e23ba0b8e42ccded27d..f126c6b2a074a61a2e2bd5b50154b5714b426762 100644
--- a/skia/ext/bitmap_platform_device_win.cc
+++ b/skia/ext/bitmap_platform_device_win.cc
@@ -19,41 +19,6 @@
namespace {
-HBITMAP CreateHBitmap(int width, int height, bool is_opaque,
- HANDLE shared_section, void** data) {
- // CreateDIBSection appears to get unhappy if we create an empty bitmap, so
- // just create a minimal bitmap
- if ((width == 0) || (height == 0)) {
- width = 1;
- height = 1;
- }
-
- BITMAPINFOHEADER hdr = {0};
- hdr.biSize = sizeof(BITMAPINFOHEADER);
- hdr.biWidth = width;
- hdr.biHeight = -height; // minus means top-down bitmap
- hdr.biPlanes = 1;
- hdr.biBitCount = 32;
- hdr.biCompression = BI_RGB; // no compression
- hdr.biSizeImage = 0;
- hdr.biXPelsPerMeter = 1;
- hdr.biYPelsPerMeter = 1;
- hdr.biClrUsed = 0;
- hdr.biClrImportant = 0;
-
- HBITMAP hbitmap = CreateDIBSection(NULL, reinterpret_cast<BITMAPINFO*>(&hdr),
- 0, data, shared_section, 0);
-
-#if !defined(_WIN64)
- // If this call fails, we're gonna crash hard. Try to get some useful
- // information out before we crash for post-mortem analysis.
- if (!hbitmap)
- base::debug::GDIBitmapAllocFailure(&hdr, shared_section);
-#endif
-
- return hbitmap;
-}
-
void LoadClippingRegionToDC(HDC context,
const SkIRect& clip_bounds,
const SkMatrix& transformation) {
@@ -159,7 +124,8 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create(
// possible to detect when GDI is unavailable and instead directly map the
// shared memory as the bitmap.
if (base::win::IsUser32AndGdi32Available()) {
- hbitmap = CreateHBitmap(width, height, is_opaque, shared_section, &data);
+ hbitmap = skia::CreateHBitmap(width, height, is_opaque, shared_section,
+ &data);
if (!hbitmap) {
LOG(ERROR) << "CreateHBitmap failed";
return NULL;
« no previous file with comments | « no previous file | skia/ext/skia_utils_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698