Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(986)

Unified Diff: skia/sgl/SkDraw.cpp

Issue 93093: Implement canvas's globalCompositeOperation lighter properly.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/include/SkPorterDuff.h ('k') | skia/sgl/SkMask.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/sgl/SkDraw.cpp
===================================================================
--- skia/sgl/SkDraw.cpp (revision 14480)
+++ skia/sgl/SkDraw.cpp (working copy)
@@ -911,11 +911,16 @@
return;
}
}
+
mask.fFormat = SkMask::kA8_Format;
mask.fRowBytes = SkAlign4(mask.fBounds.width());
+ size_t size = mask.computeImageSize();
+ if (0 == size) {
+ // the mask is too big to allocated, draw nothing
+ return;
+ }
// allocate (and clear) our temp buffer to hold the transformed bitmap
- size_t size = mask.computeImageSize();
SkAutoMalloc storage(size);
mask.fImage = (uint8_t*)storage.get();
memset(mask.fImage, 0, size);
@@ -2336,7 +2341,12 @@
if (SkMask::kComputeBoundsAndRenderImage_CreateMode == mode) {
mask->fFormat = SkMask::kA8_Format;
mask->fRowBytes = mask->fBounds.width();
- mask->fImage = SkMask::AllocImage(mask->computeImageSize());
+ size_t size = mask->computeImageSize();
+ if (0 == size) {
+ // we're too big to allocate the mask, abort
+ return false;
+ }
+ mask->fImage = SkMask::AllocImage(size);
memset(mask->fImage, 0, mask->computeImageSize());
}
« no previous file with comments | « skia/include/SkPorterDuff.h ('k') | skia/sgl/SkMask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698