diff options
author | Mike Reed <reed@google.com> | 2017-04-01 12:14:57 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-01 16:46:11 +0000 |
commit | 9920b10f5292838f00600f676c4578cd11705e60 (patch) | |
tree | 9217d23bf701b4ccfd15d818bfea44b766ad4fc3 /include/core/SkBitmap.h | |
parent | ec61785bbb989a1901b063923da30c04ed41332f (diff) |
Revert[2] "clean up (partially) colortable api""
This reverts commit 1d1165ca6575e082b892c5460492c411618783ad.
Bug: skia:
Change-Id: Idbc0634ae3cec2e79f592d252de8751b077e6408
Reviewed-on: https://skia-review.googlesource.com/11024
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include/core/SkBitmap.h')
-rw-r--r-- | include/core/SkBitmap.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index fd25a23cdd..faff35aebe 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -238,16 +238,20 @@ public: bool setInfo(const SkImageInfo&, size_t rowBytes = 0); + enum AllocFlags { + kZeroPixels_AllocFlag = 1 << 0, + }; /** * Allocate the bitmap's pixels to match the requested image info. If the Factory * is non-null, call it to allcoate the pixelref. If the ImageInfo requires - * a colortable, then ColorTable must be non-null, and will be ref'd. + * a colortable, then ColorTable must be non-null. + * * On failure, the bitmap will be set to empty and return false. */ - bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo&, SkPixelRefFactory*, SkColorTable*); - - void allocPixels(const SkImageInfo& info, SkPixelRefFactory* factory, SkColorTable* ctable) { - if (!this->tryAllocPixels(info, factory, ctable)) { + bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo& info, sk_sp<SkColorTable> ctable, + uint32_t flags = 0); + void allocPixels(const SkImageInfo& info, sk_sp<SkColorTable> ctable, uint32_t flags = 0) { + if (!this->tryAllocPixels(info, std::move(ctable), flags)) { sk_throw(); } } |