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

Unified Diff: gm/strokefill.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/smallarc.cpp ('k') | gm/stroketext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/strokefill.cpp
diff --git a/gm/strokefill.cpp b/gm/strokefill.cpp
index e8878b5e3bba7a0109cf4ef87d9dc72655383337..4f6e6d292783976fea448c485f7dce9ffb14e93d 100644
--- a/gm/strokefill.cpp
+++ b/gm/strokefill.cpp
@@ -11,8 +11,6 @@
#include "SkTextFormatParams.h"
#include "SkTypeface.h"
-namespace skiagm {
-
/* Generated on a Mac with:
* paint.setTypeface(SkTypeface::CreateByName("Papyrus"));
* paint.getTextPath("H", 1, 100, 80, &textPath);
@@ -228,31 +226,15 @@ static SkPath hiragino_maru_gothic_pro_dash() {
return path;
}
-class StrokeFillGM : public GM {
-public:
- StrokeFillGM() {
-
- }
-
-protected:
-
- SkString onShortName() override {
- return SkString("stroke-fill");
- }
-
- SkISize onISize() override {
- return SkISize::Make(640, 480);
- }
-
- static void show_bold(SkCanvas* canvas, const void* text, int len,
- SkScalar x, SkScalar y, const SkPaint& paint) {
+static void show_bold(SkCanvas* canvas, const void* text, int len,
+ SkScalar x, SkScalar y, const SkPaint& paint) {
SkPaint p(paint);
canvas->drawText(text, len, x, y, p);
p.setFakeBoldText(true);
canvas->drawText(text, len, x, y + SkIntToScalar(120), p);
- }
-
- static void path_bold(SkCanvas* canvas, const SkPath& path, const SkPaint& paint) {
+}
+
+static void path_bold(SkCanvas* canvas, const SkPath& path, const SkPaint& paint) {
SkPaint p(paint);
canvas->drawPath(path, p);
p.setStyle(SkPaint::kStrokeAndFill_Style);
@@ -265,9 +247,10 @@ protected:
canvas->translate(0, 120);
canvas->drawPath(path, p);
canvas->restore();
- }
-
- void onDraw(SkCanvas* canvas) override {
+}
+
+DEF_SIMPLE_GM_BG_NAME(strokefill, canvas, 640, 480, SK_ColorWHITE,
+ SkString("stroke-fill")) {
SkScalar x = SkIntToScalar(100);
SkScalar y = SkIntToScalar(88);
@@ -347,13 +330,4 @@ protected:
SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCW_FirstDirection));
path4.moveTo(0, 0); // test for crbug.com/247770
canvas->drawPath(path4, paint);
- }
-
-private:
- typedef GM INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-DEF_GM(return new StrokeFillGM;)
}
« no previous file with comments | « gm/smallarc.cpp ('k') | gm/stroketext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698