Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Unified Diff: src/pdf/SkPDFImage.cpp

Issue 802713002: Handle SkBitmaps which have no pixels in SkPDFImage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/tests.gypi ('k') | tests/PDFInvalidBitmapTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFImage.cpp
diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp
index 122d2f214845dfcc111bdbe262b020ec219eeba5..73d85816aa7e070b4d022dcfe76af218597cf81a 100644
--- a/src/pdf/SkPDFImage.cpp
+++ b/src/pdf/SkPDFImage.cpp
@@ -222,7 +222,11 @@ static SkStream* extract_image_data(const SkBitmap& bitmap,
bool transparent = extractAlpha;
SkStream* stream = NULL;
- bitmap.lockPixels();
+ SkAutoLockPixels lock(bitmap);
+ if (NULL == bitmap.getPixels()) {
+ return NULL;
+ }
+
switch (colorType) {
case kIndex_8_SkColorType:
if (!extractAlpha) {
@@ -253,7 +257,6 @@ static SkStream* extract_image_data(const SkBitmap& bitmap,
default:
SkASSERT(false);
}
- bitmap.unlockPixels();
if (isTransparent != NULL) {
*isTransparent = transparent;
« no previous file with comments | « gyp/tests.gypi ('k') | tests/PDFInvalidBitmapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698