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

Unified Diff: gm/etc1bitmap.cpp

Issue 292663011: Simple PKM image decoder. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Resync 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/etc1.gyp » ('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/copyTo4444.cpp b/gm/etc1bitmap.cpp
similarity index 60%
copy from gm/copyTo4444.cpp
copy to gm/etc1bitmap.cpp
index 7e2c2798e450154700ee7e828e584b2ffd7c72d9..d2cd726886b47385450bcd6c3a75f9fb79c45359 100644
--- a/gm/copyTo4444.cpp
+++ b/gm/etc1bitmap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 Google Inc.
+ * Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
@@ -13,25 +13,28 @@
namespace skiagm {
/**
- * Test copying an image from 8888 to 4444.
+ * Test decoding an image from a PKM file and then
+ * from compressed ETC1 data.
*/
-class CopyTo4444GM : public GM {
+class ETC1BitmapGM : public GM {
public:
- CopyTo4444GM() {}
+ ETC1BitmapGM() { }
+ virtual ~ETC1BitmapGM() { }
protected:
- virtual SkString onShortName() {
- return SkString("copyTo4444");
+ virtual SkString onShortName() SK_OVERRIDE {
+ return SkString("etc1bitmap");
}
- virtual SkISize onISize() {
- return make_isize(1024, 512);
+ virtual SkISize onISize() SK_OVERRIDE {
+ return make_isize(512, 512);
}
- virtual void onDraw(SkCanvas* canvas) {
- SkBitmap bm, bm4444;
+ virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
+
+ SkBitmap bm;
SkString filename = SkOSPath::SkPathJoin(
- INHERITED::gResourcePath.c_str(), "mandrill_512.png");
+ INHERITED::gResourcePath.c_str(), "mandrill_512.pkm");
if (!SkImageDecoder::DecodeFile(filename.c_str(), &bm,
SkBitmap::kARGB_8888_Config,
SkImageDecoder::kDecodePixels_Mode)) {
@@ -40,17 +43,14 @@ protected:
return;
}
canvas->drawBitmap(bm, 0, 0);
- SkAssertResult(bm.copyTo(&bm4444, kARGB_4444_SkColorType));
- canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0);
}
private:
typedef GM INHERITED;
};
-//////////////////////////////////////////////////////////////////////////////
+} // namespace skiagm
-static GM* MyFactory(void*) { return new CopyTo4444GM; }
-static GMRegistry reg(MyFactory);
+//////////////////////////////////////////////////////////////////////////////
-}
+DEF_GM( return SkNEW(skiagm::ETC1BitmapGM); )
« no previous file with comments | « no previous file | gyp/etc1.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698