diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-23 19:43:37 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-23 19:43:37 +0000 |
commit | 640f481577770712f0038fee86d21b8db9efaea5 (patch) | |
tree | a27c6364a4e6a042e55afbc436a548cd6bb34d90 | |
parent | 05366a5c71c3e0b7be8b707a173598d5540b055f (diff) | |
download | chromium_src-640f481577770712f0038fee86d21b8db9efaea5.zip chromium_src-640f481577770712f0038fee86d21b8db9efaea5.tar.gz chromium_src-640f481577770712f0038fee86d21b8db9efaea5.tar.bz2 |
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
-rw-r--r-- | skia/ext/bitmap_platform_device_linux.cc | 7 | ||||
-rw-r--r-- | skia/ext/bitmap_platform_device_mac.cc | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/skia/ext/bitmap_platform_device_linux.cc b/skia/ext/bitmap_platform_device_linux.cc index 9b589de..5535ed1 100644 --- a/skia/ext/bitmap_platform_device_linux.cc +++ b/skia/ext/bitmap_platform_device_linux.cc @@ -130,6 +130,13 @@ void BitmapPlatformDevice::BitmapPlatformDeviceData::LoadConfig() { BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, bool is_opaque, cairo_surface_t* surface) { + 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, cairo_image_surface_get_stride(surface)); 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) |