aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2015-02-13 11:13:34 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-13 11:13:34 -0800
commit0864908ca50049d3d907fc5c3749bc8a436b4738 (patch)
treea04d0629768ac04cbb13ba235e970fe46e8460c5 /tests
parent9bafc30c7900375d316d47e24412ddfd8bd0b1f2 (diff)
Make SkImageGenerator::getPixels() return an enum.
The new enum describes the nature of the failure. This is in preparation for writing a replacement for SkImageDecoder, which will use this interface. Update the comments for getPixels() to specify what it means to pass an SkImageInfo with a different size. Make SkImageGenerator Noncopyable. Leave onGetYUV8Planes alone, since we have separate discussions regarding modifying that API. Make callers of SkImageDecoder consistently handle kPartialSuccess. Previously, some callers considered it a failure, and others considered it a success. BUG=skia:3257 Review URL: https://codereview.chromium.org/919693002
Diffstat (limited to 'tests')
-rw-r--r--tests/CachedDecodingPixelRefTest.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index e8fea2fdf2..51cb7ba38d 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -189,15 +189,15 @@ protected:
return true;
}
- virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
- SkPMColor ctable[], int* ctableCount) SK_OVERRIDE {
+ virtual Result onGetPixelsEnum(const SkImageInfo& info, void* pixels, size_t rowBytes,
+ SkPMColor ctable[], int* ctableCount) SK_OVERRIDE {
REPORTER_ASSERT(fReporter, pixels != NULL);
- size_t minRowBytes = static_cast<size_t>(info.width() * info.bytesPerPixel());
- REPORTER_ASSERT(fReporter, rowBytes >= minRowBytes);
- if ((NULL == pixels)
- || (fType != kSucceedGetPixels_TestType)
- || (info.colorType() != kN32_SkColorType)) {
- return false;
+ REPORTER_ASSERT(fReporter, rowBytes >= info.minRowBytes());
+ if (fType != kSucceedGetPixels_TestType) {
+ return kUnimplemented;
+ }
+ if (info.colorType() != kN32_SkColorType) {
+ return kInvalidConversion;
}
char* bytePtr = static_cast<char*>(pixels);
for (int y = 0; y < info.height(); ++y) {
@@ -205,7 +205,7 @@ protected:
TestImageGenerator::Color(), info.width());
bytePtr += rowBytes;
}
- return true;
+ return kSuccess;
}
private: