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

Unified Diff: src/images/SkDecodingImageGenerator.cpp

Issue 1263013002: Remove SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « src/core/SkImageGenerator.cpp ('k') | src/ports/SkImageGenerator_skia.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkDecodingImageGenerator.cpp
diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp
index 6b2f73b2e4bc7921be5e1e2f323892ef4f40c420..b4af220d718f8b808a633abd169a5a573b747f64 100644
--- a/src/images/SkDecodingImageGenerator.cpp
+++ b/src/images/SkDecodingImageGenerator.cpp
@@ -38,14 +38,8 @@ public:
protected:
SkData* onRefEncodedData() override;
-#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
- Result onGetPixels(const SkImageInfo& info,
- void* pixels, size_t rowBytes, const Options&,
- SkPMColor ctable[], int* ctableCount) override;
-#else
bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
SkPMColor ctable[], int* ctableCount) override;
-#endif
bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
SkYUVColorSpace* colorSpace) override;
@@ -149,36 +143,19 @@ SkData* DecodingImageGenerator::onRefEncodedData() {
return SkSafeRef(fData);
}
-#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
-SkImageGenerator::Result DecodingImageGenerator::onGetPixels(const SkImageInfo& info,
- void* pixels, size_t rowBytes, const Options& options, SkPMColor ctableEntries[],
- int* ctableCount) {
-#else
bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
SkPMColor ctableEntries[], int* ctableCount) {
-#endif
if (fInfo != info) {
// The caller has specified a different info. This is an
// error for this kind of SkImageGenerator. Use the Options
// to change the settings.
-#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
- if (info.dimensions() != fInfo.dimensions()) {
- return kInvalidScale;
- }
- return kInvalidConversion;
-#else
return false;
-#endif
}
SkAssertResult(fStream->rewind());
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStream));
if (NULL == decoder.get()) {
-#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
- return kInvalidInput;
-#else
return false;
-#endif
}
decoder->setDitherImage(fDitherImage);
decoder->setSampleSize(fSampleSize);
@@ -191,11 +168,7 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels,
SkImageDecoder::kDecodePixels_Mode);
decoder->setAllocator(NULL);
if (SkImageDecoder::kFailure == decodeResult) {
-#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
- return kInvalidInput;
-#else
return false;
-#endif
}
if (allocator.isReady()) { // Did not use pixels!
SkBitmap bm;
@@ -204,11 +177,7 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels,
if (!copySuccess || allocator.isReady()) {
SkDEBUGFAIL("bitmap.copyTo(requestedConfig) failed.");
// Earlier we checked canCopyto(); we expect consistency.
-#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
- return kInvalidConversion;
-#else
return false;
-#endif
}
SkASSERT(check_alpha(info.alphaType(), bm.alphaType()));
} else {
@@ -218,32 +187,17 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels,
if (kIndex_8_SkColorType == info.colorType()) {
if (kIndex_8_SkColorType != bitmap.colorType()) {
// they asked for Index8, but we didn't receive that from decoder
-#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
- return kInvalidConversion;
-#else
return false;
-#endif
}
SkColorTable* ctable = bitmap.getColorTable();
if (NULL == ctable) {
-#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
- return kInvalidConversion;
-#else
return false;
-#endif
}
const int count = ctable->count();
memcpy(ctableEntries, ctable->readColors(), count * sizeof(SkPMColor));
*ctableCount = count;
}
-#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
- if (SkImageDecoder::kPartialSuccess == decodeResult) {
- return kIncompleteInput;
- }
- return kSuccess;
-#else
return true;
-#endif
}
bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3],
« no previous file with comments | « src/core/SkImageGenerator.cpp ('k') | src/ports/SkImageGenerator_skia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698