Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1141)

Unified Diff: src/core/SkImageGenerator.cpp

Issue 1226023003: Remove SkImageGenerator pieces only for SkCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@severIG
Patch Set: Change the public interface without staging it. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageGenerator.cpp
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index 36caae99c382b6b7480be2066693c963e18d93a3..b4a3fc21c8ae835a7adfc77854e7d65ead5bcd38 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -7,22 +7,21 @@
#include "SkImageGenerator.h"
-SkImageGenerator::Result SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels,
- size_t rowBytes, const Options* options,
- SkPMColor ctable[], int* ctableCount) {
+bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
+ SkPMColor ctable[], int* ctableCount) {
if (kUnknown_SkColorType == info.colorType()) {
- return kInvalidConversion;
+ return false;
}
if (NULL == pixels) {
- return kInvalidParameters;
+ return false;
}
if (rowBytes < info.minRowBytes()) {
- return kInvalidParameters;
+ return false;
}
if (kIndex_8_SkColorType == info.colorType()) {
if (NULL == ctable || NULL == ctableCount) {
- return kInvalidParameters;
+ return false;
}
} else {
if (ctableCount) {
@@ -32,26 +31,33 @@ SkImageGenerator::Result SkImageGenerator::getPixels(const SkImageInfo& info, vo
ctable = NULL;
}
+#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
// Default options.
- Options optsStorage;
- if (NULL == options) {
- options = &optsStorage;
- }
- const Result result = this->onGetPixels(info, pixels, rowBytes, *options, ctable, ctableCount);
+ Options options;
+ const Result result = this->onGetPixels(info, pixels, rowBytes, options, ctable, ctableCount);
- if ((kIncompleteInput == result || kSuccess == result) && ctableCount) {
+ if (kIncompleteInput != result && kSuccess != result) {
+ return false;
+ }
+ if (ctableCount) {
+ SkASSERT(*ctableCount >= 0 && *ctableCount <= 256);
+ }
+ return true;
+#else
+ const bool success = this->onGetPixels(info, pixels, rowBytes, ctable, ctableCount);
+ if (success && ctableCount) {
SkASSERT(*ctableCount >= 0 && *ctableCount <= 256);
}
- return result;
+ return success;
+#endif
}
-SkImageGenerator::Result SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels,
- size_t rowBytes) {
+bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) {
SkASSERT(kIndex_8_SkColorType != info.colorType());
if (kIndex_8_SkColorType == info.colorType()) {
- return kInvalidConversion;
+ return false;
}
- return this->getPixels(info, pixels, rowBytes, NULL, NULL, NULL);
+ return this->getPixels(info, pixels, rowBytes, NULL, NULL);
}
bool SkImageGenerator::getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
@@ -112,8 +118,15 @@ SkData* SkImageGenerator::onRefEncodedData() {
return NULL;
}
+#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
SkImageGenerator::Result SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst,
size_t rb, const Options& options,
SkPMColor* colors, int* colorCount) {
return kUnimplemented;
}
+#else
+bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb,
+ SkPMColor* colors, int* colorCount) {
+ return false;
+}
+#endif
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698