| Index: src/core/SkImageGenerator.cpp
|
| diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
|
| index 36caae99c382b6b7480be2066693c963e18d93a3..6cf5519b07e84351e84d49c019b470ac238292c0 100644
|
| --- a/src/core/SkImageGenerator.cpp
|
| +++ b/src/core/SkImageGenerator.cpp
|
| @@ -7,22 +7,43 @@
|
|
|
| #include "SkImageGenerator.h"
|
|
|
| +#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
|
| SkImageGenerator::Result SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels,
|
| size_t rowBytes, const Options* options,
|
| SkPMColor ctable[], int* ctableCount) {
|
| +#else
|
| +bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
|
| + SkPMColor ctable[], int* ctableCount) {
|
| +#endif
|
| if (kUnknown_SkColorType == info.colorType()) {
|
| +#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
|
| return kInvalidConversion;
|
| +#else
|
| + return false;
|
| +#endif
|
| }
|
| if (NULL == pixels) {
|
| +#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
|
| return kInvalidParameters;
|
| +#else
|
| + return false;
|
| +#endif
|
| }
|
| if (rowBytes < info.minRowBytes()) {
|
| +#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
|
| return kInvalidParameters;
|
| +#else
|
| + return false;
|
| +#endif
|
| }
|
|
|
| if (kIndex_8_SkColorType == info.colorType()) {
|
| if (NULL == ctable || NULL == ctableCount) {
|
| +#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
|
| return kInvalidParameters;
|
| +#else
|
| + return false;
|
| +#endif
|
| }
|
| } else {
|
| if (ctableCount) {
|
| @@ -32,6 +53,7 @@ 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) {
|
| @@ -40,18 +62,35 @@ SkImageGenerator::Result SkImageGenerator::getPixels(const SkImageInfo& info, vo
|
| const Result result = this->onGetPixels(info, pixels, rowBytes, *options, ctable, ctableCount);
|
|
|
| if ((kIncompleteInput == result || kSuccess == result) && ctableCount) {
|
| +#else
|
| + const bool result = this->onGetPixels(info, pixels, rowBytes, ctable, ctableCount);
|
| + if (result && ctableCount) {
|
| +#endif
|
| SkASSERT(*ctableCount >= 0 && *ctableCount <= 256);
|
| }
|
| return result;
|
| }
|
|
|
| -SkImageGenerator::Result SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels,
|
| +#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
|
| +SkImageGenerator::Result
|
| +#else
|
| +bool
|
| +#endif
|
| +SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels,
|
| size_t rowBytes) {
|
| SkASSERT(kIndex_8_SkColorType != info.colorType());
|
| if (kIndex_8_SkColorType == info.colorType()) {
|
| +#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
|
| return kInvalidConversion;
|
| +#else
|
| + return false;
|
| +#endif
|
| }
|
| +#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
|
| return this->getPixels(info, pixels, rowBytes, NULL, NULL, NULL);
|
| +#else
|
| + return this->getPixels(info, pixels, rowBytes, NULL, NULL);
|
| +#endif
|
| }
|
|
|
| bool SkImageGenerator::getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
|
| @@ -112,8 +151,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
|
|
|