| Index: tests/CachedDecodingPixelRefTest.cpp
|
| diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
|
| index 9a005469da3bce52f138d6856fdec40feaae9f76..2d8a0e70737a66c376987caf9c2adb055026f054 100644
|
| --- a/tests/CachedDecodingPixelRefTest.cpp
|
| +++ b/tests/CachedDecodingPixelRefTest.cpp
|
| @@ -8,6 +8,7 @@
|
| #include "SkBitmap.h"
|
| #include "SkCanvas.h"
|
| #include "SkData.h"
|
| +#include "SkDecodingImageGenerator.h"
|
| #include "SkForceLinking.h"
|
| #include "SkImageDecoder.h"
|
| #include "SkImagePriv.h"
|
| @@ -244,3 +245,35 @@ DEF_TEST(CachingPixelRef, reporter) {
|
| // onDecodePixels should fail, so getting pixels will fail.
|
| REPORTER_ASSERT(reporter, NULL == lazy.getPixels());
|
| }
|
| +
|
| +static void compare_with_SkDecodingImageGenerator(skiatest::Reporter* reporter,
|
| + SkData* encoded,
|
| + const SkBitmap& original,
|
| + bool comparePixels) {
|
| +
|
| + SkBitmap lazy;
|
| + bool success = SkDecodingImageGenerator::Install(encoded, &lazy);
|
| + REPORTER_ASSERT(reporter, success);
|
| + if (!success) {
|
| + return;
|
| + }
|
| +
|
| + REPORTER_ASSERT(reporter, NULL == lazy.getPixels());
|
| + {
|
| + SkAutoLockPixels autoLockPixels(lazy); // now pixels are good.
|
| + REPORTER_ASSERT(reporter, NULL != lazy.getPixels());
|
| + if (NULL == lazy.getPixels()) {
|
| + return;
|
| + }
|
| + }
|
| + // pixels should be gone!
|
| + REPORTER_ASSERT(reporter, NULL == lazy.getPixels());
|
| + {
|
| + SkAutoLockPixels autoLockPixels(lazy); // now pixels are good.
|
| + REPORTER_ASSERT(reporter, NULL != lazy.getPixels());
|
| + }
|
| + compare_bitmaps(reporter, original, lazy, comparePixels);
|
| +}
|
| +DEF_TEST(DecodingImageGenerator, reporter) {
|
| + test_three_encodings(reporter, compare_with_SkDecodingImageGenerator);
|
| +}
|
|
|