Chromium Code Reviews| Index: tests/DrawBitmapRectTest.cpp |
| diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp |
| index ab667fdfae1635f784cead108074fbf1e8e1a700..2619249e48cf18437fda53ca849f61a98d4e6945 100644 |
| --- a/tests/DrawBitmapRectTest.cpp |
| +++ b/tests/DrawBitmapRectTest.cpp |
| @@ -7,23 +7,22 @@ |
| */ |
| #include "Test.h" |
| #include "SkBitmap.h" |
| +#include "SkBitmapFactory.h" |
| #include "SkCanvas.h" |
| #include "SkData.h" |
| +#include "SkLruImageCache.h" |
| #include "SkPaint.h" |
| #include "SkShader.h" |
| #include "SkSurface.h" |
| #include "SkRandom.h" |
| #include "SkMatrixUtils.h" |
| -#include "SkLazyPixelRef.h" |
| -#include "SkLruImageCache.h" |
| - |
| // A BitmapFactory that always fails when asked to return pixels. |
| static bool FailureDecoder(const void* data, size_t length, SkImageInfo* info, |
| const SkBitmapFactory::Target* target) { |
| if (info) { |
| info->fWidth = info->fHeight = 100; |
| - info->fColorType = kRGBA_8888_SkColorType; |
| + info->fColorType = kPMColor_SkColorType; |
|
scroggo
2013/12/02 19:00:09
Is this a separate bug?
|
| info->fAlphaType = kPremul_SkAlphaType; |
| } |
| // this will deliberately return false if they are asking us to decode |
| @@ -39,11 +38,15 @@ static void test_faulty_pixelref(skiatest::Reporter* reporter) { |
| SkLruImageCache cache(10 * 1000); |
| // construct a garbage data represent "bad" encoded data. |
| SkAutoDataUnref data(SkData::NewFromMalloc(malloc(1000), 1000)); |
| - SkAutoTUnref<SkPixelRef> pr(new SkLazyPixelRef(data, FailureDecoder, &cache)); |
| + SkBitmapFactory bitmapFactory(FailureDecoder); |
| + bitmapFactory.setImageCache(&cache); |
| SkBitmap bm; |
| - bm.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); |
| - bm.setPixelRef(pr); |
| + bool success = bitmapFactory.installPixelRef(data, &bm); |
| + REPORTER_ASSERT(reporter, success); |
| + if (!success) { |
| + return; |
| + } |
| // now our bitmap has a pixelref, but we know it will fail to lock |
| SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(200, 200)); |