diff options
author | 2011-03-14 20:30:14 +0000 | |
---|---|---|
committer | 2011-03-14 20:30:14 +0000 | |
commit | cd9d69b9ce7eb301a9fd8d91b9f95fd99b07bae5 (patch) | |
tree | 699c584b39fd1e30022bb05ce58dad15fcd9b4c7 /include/core/SkBitmap.h | |
parent | 260db92d4975c50fd929399e8d6875a4c854cd5d (diff) |
Upstreaming changes from android.
- fix compile warnings in the GPU code
- upstream android specific code (ifdef protected)
- fail gracefully when a custom allocator fails
git-svn-id: http://skia.googlecode.com/svn/trunk@936 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkBitmap.h')
-rw-r--r-- | include/core/SkBitmap.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 56d7478e48..1d21a2f994 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -468,16 +468,29 @@ public: */ int extractMipLevel(SkBitmap* dst, SkFixed sx, SkFixed sy); - void extractAlpha(SkBitmap* dst) const { - this->extractAlpha(dst, NULL, NULL, NULL); + bool extractAlpha(SkBitmap* dst) const { + return this->extractAlpha(dst, NULL, NULL, NULL); } - void extractAlpha(SkBitmap* dst, const SkPaint* paint, + bool extractAlpha(SkBitmap* dst, const SkPaint* paint, SkIPoint* offset) const { - this->extractAlpha(dst, paint, NULL, offset); + return this->extractAlpha(dst, paint, NULL, offset); } - void extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator, + /** 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 not be modified and false will be returned. + + @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 + */ + bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator, SkIPoint* offset) const; void flatten(SkFlattenableWriteBuffer&) const; |