When doing a readback in SkGrPixelRef check whether the dst bmp was allocated.
Review URL: https://codereview.appspot.com/6936068
git-svn-id: http://skia.googlecode.com/svn/trunk@6887 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp
index 255437e..081c09f 100644
--- a/src/gpu/SkGrPixelRef.cpp
+++ b/src/gpu/SkGrPixelRef.cpp
@@ -167,7 +167,10 @@
height = fSurface->height();
}
dst->setConfig(SkBitmap::kARGB_8888_Config, width, height);
- dst->allocPixels();
+ if (!dst->allocPixels()) {
+ SkDebugf("SkGrPixelRef::onReadPixels failed to alloc bitmap for result!\n");
+ return false;
+ }
SkAutoLockPixels al(*dst);
void* buffer = dst->getPixels();
return fSurface->readPixels(left, top, width, height,