diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-30 18:41:39 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-30 18:41:39 +0000 |
commit | af091a176dbf900a9ff4526ef3b6966a1de44775 (patch) | |
tree | 744c1bb783b141ea1e9c333cd6c1b38bdaaab82f /gm | |
parent | b3281585bb6ee3ad8385bf4ba46513af609fa11b (diff) |
Initial work to get ETC1 data up to the GPU
R=bsalomon@google.com, robertphillips@google.com
Author: krajcevski@google.com
Review URL: https://codereview.chromium.org/302783002
git-svn-id: http://skia.googlecode.com/svn/trunk@15001 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r-- | gm/etc1bitmap.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/gm/etc1bitmap.cpp b/gm/etc1bitmap.cpp index d2cd726886..bb8ca6f406 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()); + if (NULL == 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); } |