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
#
'skia_for_chromium_defines': [
'SK_LEGACY_DRAWPICTURECALLBACK',
- 'SK_SUPPORT_LEGACY_IMAGE_GENERATOR_RETURN',
+ 'SK_SUPPORT_LEGACY_GET_PIXELS_ENUM',
],
},
}
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
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);
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);
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;
}
*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;
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
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,
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());