Index: tests/CachedDecodingPixelRefTest.cpp |
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp |
index 2d8a0e70737a66c376987caf9c2adb055026f054..db108b827c1b6adef29f7449920336aa5e925a2f 100644 |
--- a/tests/CachedDecodingPixelRefTest.cpp |
+++ b/tests/CachedDecodingPixelRefTest.cpp |
@@ -13,7 +13,6 @@ |
#include "SkImageDecoder.h" |
#include "SkImagePriv.h" |
#include "SkLazyCachingPixelRef.h" |
-#include "SkLazyPixelRef.h" |
#include "SkScaledImageCache.h" |
#include "SkStream.h" |
@@ -53,24 +52,6 @@ static SkData* create_data_from_bitmap(const SkBitmap& bm, |
return NULL; |
} |
-/** |
- * A simplified version of SkBitmapFactory |
- */ |
-static bool simple_bitmap_factory(SkBitmapFactory::DecodeProc proc, |
- SkData* data, |
- SkBitmap* dst) { |
- SkImageInfo info; |
- if (!proc(data->data(), data->size(), &info, NULL)) { |
- return false; |
- } |
- dst->setConfig(SkImageInfoToBitmapConfig(info), info.fWidth, |
- info.fHeight, 0, info.fAlphaType); |
- SkAutoTUnref<SkLazyPixelRef> ref(SkNEW_ARGS(SkLazyPixelRef, |
- (data, proc, NULL))); |
- dst->setPixelRef(ref); |
- return true; |
-} |
- |
static void compare_bitmaps(skiatest::Reporter* reporter, |
const SkBitmap& b1, const SkBitmap& b2, |
bool pixelPerfect = true) { |
@@ -142,38 +123,6 @@ static void test_three_encodings(skiatest::Reporter* reporter, |
} |
/** |
- * This checks to see that a SkLazyPixelRef works as advertised. |
- */ |
-static void compare_with_skLazyPixelRef(skiatest::Reporter* reporter, |
- SkData* encoded, |
- const SkBitmap& original, |
- bool comparePixels) { |
- SkBitmap lazy; |
- static const SkBitmapFactory::DecodeProc decoder = |
- &(SkImageDecoder::DecodeMemoryToTarget); |
- bool success = simple_bitmap_factory(decoder, encoded, &lazy); |
- REPORTER_ASSERT(reporter, success); |
- |
- REPORTER_ASSERT(reporter, NULL == lazy.getPixels()); |
- { |
- SkAutoLockPixels autoLockPixels(lazy); // now pixels are good. |
- REPORTER_ASSERT(reporter, NULL != lazy.getPixels()); |
- } |
- // 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(LazyPixelRef, reporter) { |
- test_three_encodings(reporter, compare_with_skLazyPixelRef); |
-} |
- |
- |
- |
-/** |
* This checks to see that a SkLazyCachedPixelRef works as advertised. |
*/ |
@@ -182,7 +131,7 @@ static void compare_with_skLazyCachedPixelRef(skiatest::Reporter* reporter, |
const SkBitmap& original, |
bool comparePixels) { |
SkBitmap lazy; |
- static const SkBitmapFactory::DecodeProc decoder = |
+ static const SkLazyCachingPixelRef::DecodeProc decoder = |
&(SkImageDecoder::DecodeMemoryToTarget); |
bool success = SkLazyCachingPixelRef::Install(decoder, encoded, &lazy); |
REPORTER_ASSERT(reporter, success); |
@@ -206,13 +155,14 @@ DEF_TEST(LazyCachedPixelRef, reporter) { |
class TestPixelRef : public SkCachingPixelRef { |
public: |
- TestPixelRef(int x) : fX(x) { } |
+ explicit TestPixelRef(int x) : fX(x) { } |
virtual ~TestPixelRef() { } |
static bool Install(SkBitmap* destination, int x) { |
SkAutoTUnref<TestPixelRef> ref(SkNEW_ARGS(TestPixelRef, (x))); |
return ref->configure(destination) && destination->setPixelRef(ref); |
} |
SK_DECLARE_UNFLATTENABLE_OBJECT() |
+ |
protected: |
virtual bool onDecodeInfo(SkImageInfo* info) SK_OVERRIDE { |
if (fX == 0) { |
@@ -230,6 +180,7 @@ protected: |
size_t rowBytes) SK_OVERRIDE { |
return false; |
} |
+ |
private: |
int fX; // controls where the failure happens |
typedef SkCachingPixelRef INHERITED; |