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

Unified Diff: src/ports/SkImageGenerator_skia.cpp

Issue 919693002: Make SkImageGenerator::getPixels() return an enum. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Stage the change for chromium Created 5 years, 10 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/lazy/SkDiscardablePixelRef.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkImageGenerator_skia.cpp
diff --git a/src/ports/SkImageGenerator_skia.cpp b/src/ports/SkImageGenerator_skia.cpp
index 878a44de9c7e18cc81958a2c7e24cb8600b43acc..079da56155b30d0f62baf2c37a862f437c458330 100644
--- a/src/ports/SkImageGenerator_skia.cpp
+++ b/src/ports/SkImageGenerator_skia.cpp
@@ -52,8 +52,8 @@ protected:
return true;
}
- virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
- SkPMColor ctableEntries[], int* ctableCount) SK_OVERRIDE {
+ virtual Result onGetPixelsEnum(const SkImageInfo& info, void* pixels, size_t rowBytes,
+ SkPMColor ctableEntries[], int* ctableCount) SK_OVERRIDE {
SkMemoryStream stream(fData->data(), fData->size(), false);
SkAutoTUnref<BareMemoryAllocator> allocator(SkNEW_ARGS(BareMemoryAllocator,
(info, pixels, rowBytes)));
@@ -61,13 +61,10 @@ protected:
fDecoder->setRequireUnpremultipliedColors(kUnpremul_SkAlphaType == info.alphaType());
SkBitmap bm;
- SkImageDecoder::Result result = fDecoder->decode(&stream, &bm, info.colorType(),
- SkImageDecoder::kDecodePixels_Mode);
- switch (result) {
- case SkImageDecoder::kSuccess:
- break;
- default:
- return false;
+ const SkImageDecoder::Result result = fDecoder->decode(&stream, &bm, info.colorType(),
+ SkImageDecoder::kDecodePixels_Mode);
+ if (SkImageDecoder::kFailure == result) {
+ return kInvalidInput;
}
SkASSERT(info.colorType() == bm.info().colorType());
@@ -77,13 +74,16 @@ protected:
SkColorTable* ctable = bm.getColorTable();
if (NULL == ctable) {
- return false;
+ return kInvalidConversion;
}
const int count = ctable->count();
memcpy(ctableEntries, ctable->readColors(), count * sizeof(SkPMColor));
*ctableCount = count;
}
- return true;
+ if (SkImageDecoder::kPartialSuccess == result) {
+ return kIncompleteInput;
+ }
+ return kSuccess;
}
bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698