Index: src/pdf/SkPDFDevice.cpp |
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp |
index a9ad49e9ee19d422544824552365c0f11faf10bb..ff83aadeee7b8a27b71b52542625947553dbb8a2 100644 |
--- a/src/pdf/SkPDFDevice.cpp |
+++ b/src/pdf/SkPDFDevice.cpp |
@@ -2250,13 +2250,11 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& origMatrix, |
// the image. Avoiding alpha will reduce the pdf size and generation |
// CPU time some. |
- perspectiveBitmap.setConfig( |
- SkBitmap::kARGB_8888_Config, |
- SkScalarCeilToInt( |
- physicalPerspectiveOutline.getBounds().width()), |
- SkScalarCeilToInt( |
- physicalPerspectiveOutline.getBounds().height())); |
- perspectiveBitmap.allocPixels(); |
+ const int w = SkScalarCeilToInt(physicalPerspectiveOutline.getBounds().width()); |
+ const int h = SkScalarCeilToInt(physicalPerspectiveOutline.getBounds().height()); |
+ if (!perspectiveBitmap.allocPixels(SkImageInfo::MakeN32Premul(w, h))) { |
+ return; |
+ } |
perspectiveBitmap.eraseColor(SK_ColorTRANSPARENT); |
SkBitmapDevice device(perspectiveBitmap); |