From 640f481577770712f0038fee86d21b8db9efaea5 Mon Sep 17 00:00:00 2001
From: "brettw@chromium.org"
 <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Fri, 23 Jul 2010 19:43:37 +0000
Subject: Work around Skia's inability to handle degenerate bitmaps.

This workaround is split between Chromium and WebKit.
The corresponding WebKit change is available at
https://bugs.webkit.org/show_bug.cgi?id=41175

BUG=37986
TEST=LayoutTests/svg/filters/filter-empty-g.svg
Patch by ctruta@chromium.org
Original review http://codereview.chromium.org/2965004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53498 0039d316-1c4b-4281-b951-d872f2087c98
---
 skia/ext/bitmap_platform_device_mac.cc | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'skia/ext/bitmap_platform_device_mac.cc')

diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc
index feb192b..3eb1e7e 100644
--- a/skia/ext/bitmap_platform_device_mac.cc
+++ b/skia/ext/bitmap_platform_device_mac.cc
@@ -181,6 +181,13 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create(CGContextRef context,
                                                    int width,
                                                    int height,
                                                    bool is_opaque) {
+  if ((width == 0) || (height == 0)) {
+    // Empty Skia bitmaps can't be configured. Create a minimal bitmap that
+    // allows specific configurations, such as ARGB.
+    width = 1;
+    height = 1;
+  }
+
   SkBitmap bitmap;
   bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
   if (bitmap.allocPixels() != true)
-- 
cgit v1.1