notice if the bitmap failed to load
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 6 Jul 2011 18:16:00 +0000 (18:16 +0000)
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 6 Jul 2011 18:16:00 +0000 (18:16 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@1804 2bbb7eff-a529-9590-31e7-b0007b416f81

samplecode/SampleImageDir.cpp

index 8ef59ad..e7ab634 100644 (file)
@@ -29,6 +29,10 @@ static void drawmarshmallow(SkCanvas* canvas) {
     SkMatrix m;
 
     SkImageDecoder::DecodeFile("/Users/reed/Downloads/3elfs.jpg", &bitmap);
+    if (!bitmap.pixelRef()) {
+        return;
+    }
+
     SkShader* s = SkShader::CreateBitmapShader(bitmap,
                                                SkShader::kRepeat_TileMode,
                                                SkShader::kRepeat_TileMode);