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

Unified Diff: gm/glyph_pos_align.cpp

Issue 1333553002: GM: replace boilerplate with macros (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-09-09 (Wednesday) 11:01:10 EDT Created 5 years, 3 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 | « gm/glyph_pos.cpp ('k') | gm/gm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/glyph_pos_align.cpp
diff --git a/gm/glyph_pos_align.cpp b/gm/glyph_pos_align.cpp
index 9add494ffd035a24455c3e8f1d1886b378ab951a..e80955e1acc91d121b1ed663a1e2bc904db71cec 100644
--- a/gm/glyph_pos_align.cpp
+++ b/gm/glyph_pos_align.cpp
@@ -17,20 +17,9 @@ static const int kHeight = 600;
static const SkScalar kTextHeight = 64.0f;
static const int kMaxStringLength = 12;
-namespace skiagm {
-
-class GlyphPosAlignGM : public GM {
-protected:
-
- SkString onShortName() override {
- return SkString("glyph_pos_align");
- }
-
- SkISize onISize() override { return SkISize::Make(kWidth, kHeight); }
-
- void onDraw(SkCanvas* canvas) override {
- canvas->clear(SK_ColorBLACK);
+static void drawTestCase(SkCanvas*, const char*, SkScalar, const SkPaint&);
+DEF_SIMPLE_GM_BG(glyph_pos_align, canvas, kWidth, kHeight, SK_ColorBLACK) {
SkPaint paint;
paint.setTextSize(kTextHeight);
paint.setFakeBoldText(true);
@@ -50,9 +39,9 @@ protected:
paint.setTextAlign(SkPaint::kLeft_Align);
drawTestCase(canvas, "Left Align", 7 * kTextHeight, paint);
- }
+}
- void drawTestCase(SkCanvas* canvas, const char* text, SkScalar y, const SkPaint& paint) {
+void drawTestCase(SkCanvas* canvas, const char* text, SkScalar y, const SkPaint& paint) {
SkScalar widths[kMaxStringLength];
SkScalar posX[kMaxStringLength];
SkPoint pos[kMaxStringLength];
@@ -78,19 +67,4 @@ protected:
canvas->drawPosTextH(text, length, posX, y, paint);
canvas->drawPosText(text, length, pos, paint);
- }
-
-private:
-
- typedef GM INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-static GM* GlyphPosAlignFactory(void*) {
- return new GlyphPosAlignGM();
-}
-
-static GMRegistry reg(GlyphPosAlignFactory);
-
}
« no previous file with comments | « gm/glyph_pos.cpp ('k') | gm/gm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698