Index: src/core/SkPictureShader.cpp |
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp |
index e04e248756ea90e4d4a27ed003fbbf8f2acaa9b6..f8c2ab09f8e4c37eec252ffe56180d8bf96f6602 100644 |
--- a/src/core/SkPictureShader.cpp |
+++ b/src/core/SkPictureShader.cpp |
@@ -83,12 +83,14 @@ struct BitmapShaderRec : public SkResourceCache::Rec { |
result->reset(SkRef(rec.fShader.get())); |
SkBitmap tile; |
- rec.fShader.get()->asABitmap(&tile, NULL, NULL); |
- // FIXME: this doesn't protect the pixels from being discarded as soon as we unlock. |
- // Should be handled via a pixel ref generator instead |
- // (https://code.google.com/p/skia/issues/detail?id=3220). |
- SkAutoLockPixels alp(tile, true); |
- return tile.getPixels() != NULL; |
+ if (rec.fShader.get()->isABitmap(&tile, NULL, NULL)) { |
+ // FIXME: this doesn't protect the pixels from being discarded as soon as we unlock. |
+ // Should be handled via a pixel ref generator instead |
+ // (https://code.google.com/p/skia/issues/detail?id=3220). |
+ SkAutoLockPixels alp(tile, true); |
+ return tile.getPixels() != NULL; |
+ } |
+ return false; |
} |
}; |