aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-17 14:21:38 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-17 14:21:38 +0000
commit9be5727d96979f6a0f89b00a43c19bca97ace0fc (patch)
tree137e358595717b34d3a5ae77992881b046b5accf /src/core
parentd0deb4fa612a44adb941025af52c5179c5d11cd7 (diff)
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
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkScalerContext.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index d8efd6e1d0..50526e98b3 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -448,7 +448,11 @@ static void generateMask(const SkMask& mask, const SkPath& path,
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);