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
This commit is contained in:
bsalomon@google.com 2012-12-18 21:40:08 +00:00
parent 58be1015a0
commit 009bcca745

View File

@ -167,7 +167,10 @@ bool SkGrPixelRef::onReadPixels(SkBitmap* dst, const SkIRect* subset) {
height = fSurface->height(); height = fSurface->height();
} }
dst->setConfig(SkBitmap::kARGB_8888_Config, width, 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); SkAutoLockPixels al(*dst);
void* buffer = dst->getPixels(); void* buffer = dst->getPixels();
return fSurface->readPixels(left, top, width, height, return fSurface->readPixels(left, top, width, height,