diff options
author | Mike Reed <reed@google.com> | 2017-04-06 14:03:25 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-06 18:37:51 +0000 |
commit | 42ce38f866a25ae84fe167987fe9ca69e9cdc607 (patch) | |
tree | 666162d6857a9f0828458ef78f8c5f84f89729e2 /include | |
parent | 2e2b27fcc1505e23453b773e1de081fc7aa589e9 (diff) |
make copyTo_with_allocator android only
Bug: skia:6464
Change-Id: I3d95daae2ae854671e6231e62f200913ce3586d0
Reviewed-on: https://skia-review.googlesource.com/11486
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkBitmap.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 24d9071586..dfdb4604d1 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -596,6 +596,7 @@ public: */ bool extractSubset(SkBitmap* dst, const SkIRect& subset) const; +#ifdef SK_BUILD_FOR_ANDROID /** Makes a deep copy of this bitmap, respecting the requested colorType, * and allocating the dst pixels on the cpu. * Returns false if either there is an error (i.e. the src does not have @@ -608,11 +609,26 @@ public: * will be used. * @return true if the copy was made. */ - bool copyTo(SkBitmap* dst, SkColorType ct, Allocator* = NULL) const; + bool copyTo(SkBitmap* dst, SkColorType ct, Allocator*) const; - bool copyTo(SkBitmap* dst, Allocator* allocator = NULL) const { + bool copyTo(SkBitmap* dst, Allocator* allocator) const { return this->copyTo(dst, this->colorType(), allocator); } +#endif + + /** Makes a deep copy of this bitmap, respecting the requested colorType. + * Returns false if either there is an error (i.e. the src does not have + * pixels) or the request cannot be satisfied (e.g. the src has per-pixel + * alpha, and the requested colortype does not support alpha). + * @param dst The bitmap to be sized and allocated + * @param ct The desired colorType for dst + * @return true if the copy was made. + */ + bool copyTo(SkBitmap* dst, SkColorType ct) const; + + bool copyTo(SkBitmap* dst) const { + return this->copyTo(dst, this->colorType()); + } /** * Copy the bitmap's pixels into the specified buffer (pixels + rowBytes), @@ -770,6 +786,8 @@ private: bool writePixels(const SkPixmap& src, int x, int y, SkTransferFunctionBehavior behavior); + bool internalCopyTo(SkBitmap* dst, SkColorType ct, Allocator*) const; + /* Unreference any pixelrefs or colortables */ void freePixels(); |