GM: replace boilerplate with macros
I have verified locally that nothing draws differently.
Motivation:
* SK_SIMPLE_GM makes it easier to write a GM.
* Reducing 1100 lines of code makes maintenance easier.
* Simple GMs are easy to convert to Fiddles.
Review URL: https://codereview.chromium.org/1333553002
diff --git a/gm/astcbitmap.cpp b/gm/astcbitmap.cpp
index bc5e1e9..d3191e25 100644
--- a/gm/astcbitmap.cpp
+++ b/gm/astcbitmap.cpp
@@ -42,26 +42,12 @@
return kASTCFilenames[idx];
}
-namespace skiagm {
+namespace {
+const int kGMDimension = 600;
+const int kBitmapDimension = kGMDimension / 4;
+} // namespace
-/**
- * Test decoding an image from an ASTC file and then from compressed ASTC data.
- */
-class ASTCBitmapGM : public GM {
-public:
- ASTCBitmapGM() { }
- virtual ~ASTCBitmapGM() { }
-
-protected:
- SkString onShortName() override {
- return SkString("astcbitmap");
- }
-
- SkISize onISize() override {
- return SkISize::Make(kGMDimension, kGMDimension);
- }
-
- void onDraw(SkCanvas* canvas) override {
+DEF_SIMPLE_GM(astcbitmap, canvas, kGMDimension, kGMDimension) {
for (int j = 0; j < 4; ++j) {
for (int i = 0; i < 4; ++i) {
SkString filename = GetResourcePath(get_astc_filename(j*4+i));
@@ -86,17 +72,4 @@
canvas->drawBitmap(bm, bmX, bmY);
}
}
- }
-
-private:
- static const int kGMDimension = 600;
- static const int kBitmapDimension = kGMDimension/4;
-
- typedef GM INHERITED;
-};
-
-} // namespace skiagm
-
-//////////////////////////////////////////////////////////////////////////////
-
-DEF_GM(return new skiagm::ASTCBitmapGM;)
+}