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..d1c0ccbf44895fef6677ba599b1a480c13ddea7e 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) { |
@@ -87,8 +52,8 @@ void DrawToNativeContext(SkCanvas* canvas, HDC destination_hdc, int x, int y, |
HDC BitmapPlatformDevice::GetBitmapDC(const SkMatrix& transform, |
const SkIRect& clip_bounds) { |
if (!hdc_) { |
- hdc_ = CreateCompatibleDC(NULL); |
- InitializeDC(hdc_); |
+ hdc_ = CreateCompatibleDC(nullptr); |
+ skia::InitializeDC(hdc_); |
old_hbitmap_ = static_cast<HBITMAP>(SelectObject(hdc_, hbitmap_)); |
} |
@@ -159,7 +124,7 @@ 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, shared_section, &data); |
if (!hbitmap) { |
LOG(ERROR) << "CreateHBitmap failed"; |
return NULL; |
@@ -255,7 +220,7 @@ SkCanvas* CreatePlatformCanvas(int width, |
HANDLE shared_section, |
OnFailureType failureType) { |
sk_sp<SkBaseDevice> dev( |
- BitmapPlatformDevice::Create(width, height, is_opaque, shared_section)); |
+ BitmapPlatformDevice::Create(width, height, shared_section)); |
return CreateCanvas(dev, failureType); |
} |