Chromium Code Reviews| Index: gm/etc1bitmap.cpp |
| diff --git a/gm/etc1bitmap.cpp b/gm/etc1bitmap.cpp |
| index d2cd726886b47385450bcd6c3a75f9fb79c45359..50ca4294c03c517d5c5aa7da5b01743945f64ddc 100644 |
| --- a/gm/etc1bitmap.cpp |
| +++ b/gm/etc1bitmap.cpp |
| @@ -7,6 +7,8 @@ |
| #include "gm.h" |
| #include "SkCanvas.h" |
| +#include "SkData.h" |
| +#include "SkDecodingImageGenerator.h" |
| #include "SkImageDecoder.h" |
| #include "SkOSFile.h" |
| @@ -35,13 +37,20 @@ protected: |
| SkBitmap bm; |
| SkString filename = SkOSPath::SkPathJoin( |
| INHERITED::gResourcePath.c_str(), "mandrill_512.pkm"); |
| - if (!SkImageDecoder::DecodeFile(filename.c_str(), &bm, |
| - SkBitmap::kARGB_8888_Config, |
| - SkImageDecoder::kDecodePixels_Mode)) { |
| - SkDebugf("Could not decode the file. Did you forget to set the " |
| - "resourcePath?\n"); |
| + |
| + SkData *fileData = SkData::NewFromFileName(filename.c_str()); |
|
robertphillips
2014/05/27 22:01:50
NULL == fileData ?
krajcevski
2014/05/27 22:19:29
Done.
|
| + if (!fileData) { |
| + SkDebugf("Could not open the file. Did you forget to set the resourcePath?\n"); |
| return; |
| } |
| + |
| + if (!SkInstallDiscardablePixelRef( |
| + SkDecodingImageGenerator::Create( |
| + fileData, SkDecodingImageGenerator::Options()), &bm)) { |
| + SkDebugf("Could not install discardable pixel ref.\n"); |
| + return; |
| + } |
| + |
| canvas->drawBitmap(bm, 0, 0); |
| } |