aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkImageGenerator.cpp
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-05-12 11:41:27 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-12 16:48:17 +0000
commitebb1b5c297e394ab19f99d807095672b7f5d8aef (patch)
tree5f2fcd7f15da445df1efd5861b708df8f35c5ba0 /src/core/SkImageGenerator.cpp
parent7c8460e10135c05a42d0744b84838bbc24398ac2 (diff)
Add new SkImageGenerator::getPixels() API, deprecate the old
This is fairly aggressive in that it will break any client that is currently using SkImageGenerator with kIndex8. I'm guessing that we don't have any clients doing that. Bug: skia:6620 Change-Id: Ifd16f5232bb3a9f759c225315c57492d917ed9ca Reviewed-on: https://skia-review.googlesource.com/16601 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'src/core/SkImageGenerator.cpp')
-rw-r--r--src/core/SkImageGenerator.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index 35eaf8900e..d0d8f97c74 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -14,6 +14,7 @@ SkImageGenerator::SkImageGenerator(const SkImageInfo& info, uint32_t uniqueID)
, fUniqueID(kNeedNewImageUniqueID == uniqueID ? SkNextID::ImageID() : uniqueID)
{}
+#ifdef SK_SUPPORT_LEGACY_IMGEN_API
bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
SkPMColor ctable[], int* ctableCount) {
if (kUnknown_SkColorType == info.colorType()) {
@@ -44,9 +45,20 @@ bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
}
return success;
}
+#endif
bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
const Options* opts) {
+ if (kUnknown_SkColorType == info.colorType() || kIndex_8_SkColorType == info.colorType()) {
+ return false;
+ }
+ if (nullptr == pixels) {
+ return false;
+ }
+ if (rowBytes < info.minRowBytes()) {
+ return false;
+ }
+
Options defaultOpts;
if (!opts) {
opts = &defaultOpts;
@@ -55,11 +67,7 @@ bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
}
bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) {
- SkASSERT(kIndex_8_SkColorType != info.colorType());
- if (kIndex_8_SkColorType == info.colorType()) {
- return false;
- }
- return this->getPixels(info, pixels, rowBytes, nullptr, nullptr);
+ return this->getPixels(info, pixels, rowBytes, nullptr);
}
bool SkImageGenerator::queryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const {