aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Hassold <hassold@google.com>2011-02-22 11:56:07 -0800
committerEric Hassold <hassold@google.com>2011-02-23 12:30:28 -0800
commit800e1ff0b9eaff0b02ce711bb7f22f2149141c9e (patch)
treec44325227135d599aa1b1b8f583f9fd8d6aeac35 /include
parentdd3f189dfde60f95f6be0517f1c28ad2879973a1 (diff)
downloadexternal_skia-800e1ff0b9eaff0b02ce711bb7f22f2149141c9e.zip
external_skia-800e1ff0b9eaff0b02ce711bb7f22f2149141c9e.tar.gz
external_skia-800e1ff0b9eaff0b02ce711bb7f22f2149141c9e.tar.bz2
Check for pixels allocation failure
Standard memory allocator in Skia abort when an allocation request fails. However, when allocating in managed heap, need to check for allocation failure in allocPixels(). This add checks for all allocPixels calls in Skia Bitmap code. Bug: 3418381 Change-Id: I3c4ac403a3c073d64a689b29d3baccdc7fc90e1a
Diffstat (limited to 'include')
-rw-r--r--include/core/SkBitmap.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 1def198..84d069c 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -404,6 +404,19 @@ public:
this->extractAlpha(dst, paint, NULL, offset);
}
+ /** Set dst to contain alpha layer of this bitmap. If destination bitmap
+ fails to be initialized, e.g. because allocator can't allocate pixels
+ for it, dst will be resetted (zero width and height, no pixels).
+
+ @param dst The bitmap to be filled with alpha layer
+ @param paint The paint to draw with
+ @param allocator Allocator used to allocate the pixelref for the dst
+ bitmap. If this is null, the standard HeapAllocator
+ will be used.
+ @param offset If not null, it is set to top-left coordinate to position
+ the returned bitmap so that it visually lines up with the
+ original
+ */
void extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator,
SkIPoint* offset) const;