| Index: src/lazy/SkLazyCachingPixelRef.cpp
|
| diff --git a/src/lazy/SkLazyCachingPixelRef.cpp b/src/lazy/SkLazyCachingPixelRef.cpp
|
| index 730b5f7d27db8874becd65a01680292a5cdc5576..5ded9f3bdedd1b984292b3e7960188c363f0f1d3 100644
|
| --- a/src/lazy/SkLazyCachingPixelRef.cpp
|
| +++ b/src/lazy/SkLazyCachingPixelRef.cpp
|
| @@ -13,9 +13,12 @@
|
| #include "SkLazyCachingPixelRef.h"
|
| #include "SkPostConfig.h"
|
|
|
| -SkLazyCachingPixelRef::SkLazyCachingPixelRef(SkData* data,
|
| +SkLazyCachingPixelRef::SkLazyCachingPixelRef(const SkImageInfo& info,
|
| + SkData* data,
|
| SkBitmapFactory::DecodeProc proc)
|
| - : fDecodeProc(proc) {
|
| + : INHERITED(info)
|
| + , fDecodeProc(proc)
|
| +{
|
| if (NULL == data) {
|
| fData = SkData::NewEmpty();
|
| } else {
|
| @@ -33,29 +36,22 @@ SkLazyCachingPixelRef::~SkLazyCachingPixelRef() {
|
| fData->unref();
|
| }
|
|
|
| -bool SkLazyCachingPixelRef::onDecodeInfo(SkImageInfo* info) {
|
| - SkASSERT(info);
|
| - return fDecodeProc(fData->data(), fData->size(), info, NULL);
|
| -}
|
| -
|
| -bool SkLazyCachingPixelRef::onDecodePixels(const SkImageInfo& passedInfo,
|
| - void* pixels, size_t rowBytes) {
|
| +bool SkLazyCachingPixelRef::onDecodePixels(void* pixels, size_t rowBytes) {
|
| SkASSERT(pixels);
|
| - SkImageInfo info;
|
| - if (!this->getInfo(&info)) {
|
| - return false;
|
| - }
|
| - if (passedInfo != info) {
|
| - return false; // This implementation can not handle this case.
|
| - }
|
| - SkBitmapFactory::Target target = {pixels, rowBytes};
|
| + SkImageInfo info = this->info();
|
| + SkBitmapFactory::Target target = { pixels, rowBytes };
|
| return fDecodeProc(fData->data(), fData->size(), &info, &target);
|
| }
|
|
|
| bool SkLazyCachingPixelRef::Install(SkBitmapFactory::DecodeProc proc,
|
| SkData* data,
|
| SkBitmap* destination) {
|
| + SkImageInfo info;
|
| + if (!proc(data->data(), data->size(), &info, NULL)) {
|
| + return false;
|
| + }
|
| +
|
| SkAutoTUnref<SkLazyCachingPixelRef> ref(
|
| - SkNEW_ARGS(SkLazyCachingPixelRef, (data, proc)));
|
| + SkNEW_ARGS(SkLazyCachingPixelRef, (info, data, proc)));
|
| return ref->configure(destination) && destination->setPixelRef(ref);
|
| }
|
|
|