From: scroggo Date: Fri, 20 Feb 2015 02:44:58 +0000 (-0800) Subject: Rename onGetPixelsEnum back to onGetPixels. X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~3515 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=87fa631969e0bdbee3c0845aa2b9bf35b9b82eb0;p=platform%2Fupstream%2FlibSkiaSharp.git Rename onGetPixelsEnum back to onGetPixels. Replace the old signature of onGetPixels (return bool) to return an enum (Result). Remove onGetPixelsEnum. Add a define for onGetPixelsEnum to onGetPixels. This is for staging in Chromium, where some implementations override onGetPixelsEnum. Add the define in skia_for_chromium_defines. Remove SK_SUPPORT_LEGACY_IMAGE_GENERATOR_RETURN, which is no longer needed by Chromium. BUG=skia:3257 Review URL: https://codereview.chromium.org/939113002 --- diff --git a/gyp/skia_for_chromium_defines.gypi b/gyp/skia_for_chromium_defines.gypi index bcb33a2..6d10ac2 100644 --- a/gyp/skia_for_chromium_defines.gypi +++ b/gyp/skia_for_chromium_defines.gypi @@ -14,7 +14,7 @@ # 'skia_for_chromium_defines': [ 'SK_LEGACY_DRAWPICTURECALLBACK', - 'SK_SUPPORT_LEGACY_IMAGE_GENERATOR_RETURN', + 'SK_SUPPORT_LEGACY_GET_PIXELS_ENUM', ], }, } diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h index de58b68..4e89d76 100644 --- a/include/core/SkImageGenerator.h +++ b/include/core/SkImageGenerator.h @@ -15,7 +15,11 @@ class SkBitmap; class SkData; class SkImageGenerator; -//#define SK_SUPPORT_LEGACY_IMAGE_GENERATOR_RETURN +//#define SK_SUPPORT_LEGACY_GET_PIXELS_ENUM + +#ifdef SK_SUPPORT_LEGACY_GET_PIXELS_ENUM + #define onGetPixelsEnum onGetPixels +#endif /** * Takes ownership of SkImageGenerator. If this method fails for @@ -179,15 +183,9 @@ public: protected: virtual SkData* onRefEncodedData(); virtual bool onGetInfo(SkImageInfo* info); -#ifdef SK_SUPPORT_LEGACY_IMAGE_GENERATOR_RETURN - virtual bool onGetPixels(const SkImageInfo& info, - void* pixels, size_t rowBytes, - SkPMColor ctable[], int* ctableCount); -#endif - // TODO (scroggo): rename to onGetPixels. - virtual Result onGetPixelsEnum(const SkImageInfo& info, - void* pixels, size_t rowBytes, - SkPMColor ctable[], int* ctableCount); + virtual Result onGetPixels(const SkImageInfo& info, + void* pixels, size_t rowBytes, + SkPMColor ctable[], int* ctableCount); virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]); virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], SkYUVColorSpace* colorSpace); diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp index 0e43d1d..aabe83e 100644 --- a/src/core/SkImageGenerator.cpp +++ b/src/core/SkImageGenerator.cpp @@ -40,7 +40,7 @@ SkImageGenerator::Result SkImageGenerator::getPixels(const SkImageInfo& info, vo ctable = NULL; } - const Result result = this->onGetPixelsEnum(info, pixels, rowBytes, ctable, ctableCount); + const Result result = this->onGetPixels(info, pixels, rowBytes, ctable, ctableCount); if ((kIncompleteInput == result || kSuccess == result) && ctableCount) { SkASSERT(*ctableCount >= 0 && *ctableCount <= 256); @@ -119,19 +119,7 @@ bool SkImageGenerator::onGetInfo(SkImageInfo*) { return false; } -#ifdef SK_SUPPORT_LEGACY_IMAGE_GENERATOR_RETURN -bool SkImageGenerator::onGetPixels(const SkImageInfo&, void*, size_t, +SkImageGenerator::Result SkImageGenerator::onGetPixels(const SkImageInfo&, void*, size_t, SkPMColor*, int*) { - return false; -} -#endif -SkImageGenerator::Result SkImageGenerator::onGetPixelsEnum(const SkImageInfo& info, void* pixels, - size_t rowBytes, SkPMColor* colors, - int* colorCount) { -#ifdef SK_SUPPORT_LEGACY_IMAGE_GENERATOR_RETURN - if (this->onGetPixels(info, pixels, rowBytes, colors, colorCount)) { - return kSuccess; - } -#endif return kUnimplemented; } diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp index cce01d2..f9b9393 100644 --- a/src/images/SkDecodingImageGenerator.cpp +++ b/src/images/SkDecodingImageGenerator.cpp @@ -42,9 +42,9 @@ protected: *info = fInfo; return true; } - virtual Result onGetPixelsEnum(const SkImageInfo& info, - void* pixels, size_t rowBytes, - SkPMColor ctable[], int* ctableCount) SK_OVERRIDE; + virtual Result onGetPixels(const SkImageInfo& info, + void* pixels, size_t rowBytes, + SkPMColor ctable[], int* ctableCount) SK_OVERRIDE; virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], SkYUVColorSpace* colorSpace) SK_OVERRIDE; @@ -147,7 +147,7 @@ SkData* DecodingImageGenerator::onRefEncodedData() { return SkSafeRef(fData); } -SkImageGenerator::Result DecodingImageGenerator::onGetPixelsEnum(const SkImageInfo& info, +SkImageGenerator::Result DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor ctableEntries[], int* ctableCount) { if (fInfo != info) { // The caller has specified a different info. This is an diff --git a/src/ports/SkImageGenerator_skia.cpp b/src/ports/SkImageGenerator_skia.cpp index 079da56..6c27f45 100644 --- a/src/ports/SkImageGenerator_skia.cpp +++ b/src/ports/SkImageGenerator_skia.cpp @@ -52,7 +52,7 @@ protected: return true; } - virtual Result onGetPixelsEnum(const SkImageInfo& info, void* pixels, size_t rowBytes, + virtual Result onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor ctableEntries[], int* ctableCount) SK_OVERRIDE { SkMemoryStream stream(fData->data(), fData->size(), false); SkAutoTUnref allocator(SkNEW_ARGS(BareMemoryAllocator, diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp index 51cb7ba..3882026 100644 --- a/tests/CachedDecodingPixelRefTest.cpp +++ b/tests/CachedDecodingPixelRefTest.cpp @@ -189,7 +189,7 @@ protected: return true; } - virtual Result onGetPixelsEnum(const SkImageInfo& info, void* pixels, size_t rowBytes, + virtual Result onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor ctable[], int* ctableCount) SK_OVERRIDE { REPORTER_ASSERT(fReporter, pixels != NULL); REPORTER_ASSERT(fReporter, rowBytes >= info.minRowBytes());