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

Unified Diff: gm/etc1bitmap.cpp

Issue 302333002: Initial KTX file decoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review comments 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/images.gyp » ('j') | include/core/SkImageDecoder.h » ('J')
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 bb8ca6f406022a7ad0cc0947705cee30b25d0809..e205f7de0b012f301f6bb3db3eaebb237a54c84b 100644
--- a/gm/etc1bitmap.cpp
+++ b/gm/etc1bitmap.cpp
@@ -25,18 +25,22 @@ public:
protected:
virtual SkString onShortName() SK_OVERRIDE {
- return SkString("etc1bitmap");
+ SkString str = SkString("etc1bitmap_");
+ str.append(this->fileExtension());
+ return str;
}
virtual SkISize onISize() SK_OVERRIDE {
- return make_isize(512, 512);
+ return make_isize(128, 128);
}
- virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
+ virtual SkString fileExtension() const = 0;
+ virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkBitmap bm;
SkString filename = SkOSPath::SkPathJoin(
- INHERITED::gResourcePath.c_str(), "mandrill_512.pkm");
+ INHERITED::gResourcePath.c_str(), "mandrill_128.");
+ filename.append(this->fileExtension());
SkData *fileData = SkData::NewFromFileName(filename.c_str());
if (NULL == fileData) {
@@ -58,8 +62,37 @@ private:
typedef GM INHERITED;
};
+// This class specializes ETC1BitmapGM to load the mandrill_128.pkm file.
+class ETC1Bitmap_PKM_GM : public ETC1BitmapGM {
+public:
+ ETC1Bitmap_PKM_GM() : ETC1BitmapGM() { }
+ virtual ~ETC1Bitmap_PKM_GM() { }
+
+protected:
+
+ virtual SkString fileExtension() const SK_OVERRIDE { return SkString("pkm"); }
+
+private:
+ typedef ETC1BitmapGM INHERITED;
+};
+
+// This class specializes ETC1BitmapGM to load the mandrill_128.ktx file.
+class ETC1Bitmap_KTX_GM : public ETC1BitmapGM {
+public:
+ ETC1Bitmap_KTX_GM() : ETC1BitmapGM() { }
+ virtual ~ETC1Bitmap_KTX_GM() { }
+
+protected:
+
+ virtual SkString fileExtension() const SK_OVERRIDE { return SkString("ktx"); }
+
+private:
+ typedef ETC1BitmapGM INHERITED;
+};
+
} // namespace skiagm
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(skiagm::ETC1BitmapGM); )
+DEF_GM( return SkNEW(skiagm::ETC1Bitmap_PKM_GM); )
+DEF_GM( return SkNEW(skiagm::ETC1Bitmap_KTX_GM); )
« no previous file with comments | « no previous file | gyp/images.gyp » ('j') | include/core/SkImageDecoder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698