add ADD xfermode
safely handle (don't draw) if the size of SkMask exceeds 31bits
git-svn-id: http://skia.googlecode.com/svn/trunk@159 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/SkLayerRasterizer.cpp b/src/effects/SkLayerRasterizer.cpp
index ad16ea8..5aa883d 100644
--- a/src/effects/SkLayerRasterizer.cpp
+++ b/src/effects/SkLayerRasterizer.cpp
@@ -108,8 +108,12 @@
{
mask->fFormat = SkMask::kA8_Format;
mask->fRowBytes = mask->fBounds.width();
- mask->fImage = SkMask::AllocImage(mask->computeImageSize());
- memset(mask->fImage, 0, mask->computeImageSize());
+ size_t size = mask->computeImageSize();
+ if (0 == size) {
+ return false; // too big to allocate, abort
+ }
+ mask->fImage = SkMask::AllocImage(size);
+ memset(mask->fImage, 0, size);
}
if (SkMask::kJustComputeBounds_CreateMode != mode)