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/SkBlurMask.cpp b/src/effects/SkBlurMask.cpp
index 416eda4..8c7c64e 100644
--- a/src/effects/SkBlurMask.cpp
+++ b/src/effects/SkBlurMask.cpp
@@ -234,10 +234,15 @@
if (src.fImage)
{
+ size_t dstSize = dst->computeImageSize();
+ if (0 == dstSize) {
+ return false; // too big to allocate, abort
+ }
+
int sw = src.fBounds.width();
int sh = src.fBounds.height();
const uint8_t* sp = src.fImage;
- uint8_t* dp = SkMask::AllocImage(dst->computeImageSize());
+ uint8_t* dp = SkMask::AllocImage(dstSize);
SkAutoTCallVProc<uint8_t, SkMask_FreeImage> autoCall(dp);
@@ -258,7 +263,11 @@
// the blur into it (applying the src)
if (style == kInner_Style)
{
- dst->fImage = SkMask::AllocImage(src.computeImageSize());
+ size_t srcSize = src.computeImageSize();
+ if (0 == srcSize) {
+ return false; // too big to allocate, abort
+ }
+ dst->fImage = SkMask::AllocImage(srcSize);
merge_src_with_blur(dst->fImage, sp, sw, sh,
dp + rx + ry*dst->fBounds.width(),
dst->fBounds.width());