Chromium Code Reviews| Index: gm/factory.cpp |
| diff --git a/gm/factory.cpp b/gm/factory.cpp |
| index 6734235abb583aa66b5325feeca1ff1e5edefd1e..548de80bb39f57bd5749b6751da3c39816628151 100644 |
| --- a/gm/factory.cpp |
| +++ b/gm/factory.cpp |
| @@ -6,12 +6,13 @@ |
| */ |
| #include "gm.h" |
| -#include "SkBitmapFactory.h" |
| #include "SkCanvas.h" |
| #include "SkData.h" |
| +#include "SkDecodingImageGenerator.h" |
| +#include "SkDiscardablePixelRef.h" |
| #include "SkImageDecoder.h" |
| -#include "SkLruImageCache.h" |
| #include "SkOSFile.h" |
| +#include "SkDiscardableMemoryPool.h" |
| #include "SkStream.h" |
| namespace skiagm { |
| @@ -36,12 +37,14 @@ protected: |
| void* buffer = sk_malloc_throw(length); |
| stream->read(buffer, length); |
| SkAutoDataUnref data(SkData::NewFromMalloc(buffer, length)); |
| - SkBitmapFactory factory(&SkImageDecoder::DecodeMemoryToTarget); |
| + |
| + SkASSERT(NULL == data.get()); |
|
scroggo
2013/12/03 23:00:01
How is data NULL here? Did you test with the resou
hal.canary
2013/12/04 00:01:36
I meant to write !=, and I haven't gotten around t
hal.canary
2013/12/04 14:30:33
Tested with `out/Debug/gm --match factory --resour
|
| // Create a cache which will boot the pixels out anytime the |
| // bitmap is unlocked. |
| - SkAutoTUnref<SkLruImageCache> cache(SkNEW_ARGS(SkLruImageCache, (1))); |
| - factory.setImageCache(cache); |
| - factory.installPixelRef(data, &fBitmap); |
| + SkAutoTUnref<SkDiscardableMemoryPool> pool( |
| + SkNEW_ARGS(SkDiscardableMemoryPool, (1))); |
| + SkAssertResult(SkDecodingImageGenerator::Install(data, |
| + &fBitmap, pool)); |
| } |
| } |