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
This commit is contained in:
scroggo 2015-02-19 18:44:58 -08:00 committed by Commit bot
parent 8974774c32
commit 87fa631969
6 changed files with 17 additions and 31 deletions

View File

@ -14,7 +14,7 @@
#
'skia_for_chromium_defines': [
'SK_LEGACY_DRAWPICTURECALLBACK',
'SK_SUPPORT_LEGACY_IMAGE_GENERATOR_RETURN',
'SK_SUPPORT_LEGACY_GET_PIXELS_ENUM',
],
},
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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

View File

@ -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,

View File

@ -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());