diff options
Diffstat (limited to 'skia')
-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) |