detect out-of-memory when we try to create a mask offscreen
git-svn-id: http://skia.googlecode.com/svn/trunk@6839 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index d8efd6e..50526e9 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -448,7 +448,11 @@
bm.setConfig(config, dstW, dstH, dstRB);
if (0 == dstRB) {
- bm.allocPixels();
+ if (!bm.allocPixels()) {
+ // can't allocate offscreen, so empty the mask and return
+ sk_bzero(mask.fImage, mask.computeImageSize());
+ return;
+ }
bm.lockPixels();
} else {
bm.setPixels(mask.fImage);