diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-23 03:59:35 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-23 03:59:35 +0000 |
commit | 8a2ad3cae710f05cca57e48dd1732d575dba2dc7 (patch) | |
tree | 65d3463543af4bc3d330de2bef37cffc6d10395e /include | |
parent | d5b294acad96ffa3ccb5c56f6290036922f76907 (diff) |
add new copyTo version to SkBitmap, which takes SkColorType
BUG=skia:
R=scroggo@google.com, halcanary@google.com, bsalomon@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/171723007
git-svn-id: http://skia.googlecode.com/svn/trunk@13553 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkBitmap.h | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 80ccd0ae51..364a1cd64f 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -14,6 +14,8 @@ #include "SkPoint.h" #include "SkRefCnt.h" +//#define SK_SUPPORT_LEGACY_COPYTO_CONFIG + struct SkMask; struct SkIRect; struct SkRect; @@ -618,19 +620,33 @@ public: */ bool extractSubset(SkBitmap* dst, const SkIRect& subset) const; - /** Makes a deep copy of this bitmap, respecting the requested config, +#ifdef SK_SUPPORT_LEGACY_COPYTO_CONFIG + bool copyTo(SkBitmap* dst, Config c, Allocator* allocator) const; + bool canCopyTo(Config newConfig) const; +#endif + /** 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 * pixels) or the request cannot be satisfied (e.g. the src has per-pixel * alpha, and the requested config does not support alpha). * @param dst The bitmap to be sized and allocated - * @param c The desired config for dst + * @param ct The desired colorType for dst * @param allocator Allocator used to allocate the pixelref for the dst * bitmap. If this is null, the standard HeapAllocator * will be used. - * @return true if the copy could be made. + * @return true if the copy was made. */ - bool copyTo(SkBitmap* dst, Config c, Allocator* allocator = NULL) const; + bool copyTo(SkBitmap* dst, SkColorType ct, Allocator* = NULL) const; + + bool copyTo(SkBitmap* dst, Allocator* allocator = NULL) const { + return this->copyTo(dst, this->colorType(), allocator); + } + + /** + * Returns true if this bitmap's pixels can be converted into the requested + * colorType, such that copyTo() could succeed. + */ + bool canCopyTo(SkColorType colorType) const; /** Makes a deep copy of this bitmap, respecting the requested config, and * with custom allocation logic that will keep the copied pixels @@ -653,11 +669,6 @@ public: */ bool deepCopyTo(SkBitmap* dst) const; - /** Returns true if this bitmap can be deep copied into the requested config - by calling copyTo(). - */ - bool canCopyTo(Config newConfig) const; - SK_ATTR_DEPRECATED("use setFilterLevel on SkPaint") void buildMipMap(bool forceRebuild = false); |