aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2015-02-19 18:44:58 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-19 18:44:58 -0800
commit87fa631969e0bdbee3c0845aa2b9bf35b9b82eb0 (patch)
tree72ddd7049f2dedcd5352bbd430a505ee65ece24c
parent8974774c32b5f0365d375a81d5d047c5c2406614 (diff)
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
-rw-r--r--gyp/skia_for_chromium_defines.gypi2
-rw-r--r--include/core/SkImageGenerator.h18
-rw-r--r--src/core/SkImageGenerator.cpp16
-rw-r--r--src/images/SkDecodingImageGenerator.cpp8
-rw-r--r--src/ports/SkImageGenerator_skia.cpp2
-rw-r--r--tests/CachedDecodingPixelRefTest.cpp2
6 files changed, 17 insertions, 31 deletions
diff --git a/gyp/skia_for_chromium_defines.gypi b/gyp/skia_for_chromium_defines.gypi
index bcb33a2796..6d10ac2343 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 de58b68ce0..4e89d7653e 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 0e43d1d182..aabe83e4f9 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 cce01d2832..f9b9393e00 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 079da56155..6c27f45a56 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<BareMemoryAllocator> allocator(SkNEW_ARGS(BareMemoryAllocator,
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index 51cb7ba38d..3882026c77 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());