Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: gm/etc1bitmap.cpp

Issue 302783002: Initial work to get ETC1 data up to the GPU (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add #define to not always compile in ETC1 support Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gyp/common_conditions.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/etc1bitmap.cpp
diff --git a/gm/etc1bitmap.cpp b/gm/etc1bitmap.cpp
index d2cd726886b47385450bcd6c3a75f9fb79c45359..bb8ca6f406022a7ad0cc0947705cee30b25d0809 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);
}
« no previous file with comments | « no previous file | gyp/common_conditions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698