Index: gm/shadertext2.cpp |
diff --git a/gm/shadertext2.cpp b/gm/shadertext2.cpp |
index 31d1e8986957d7e4f7b648736babe08ccff34058..9f8f06617fde3d671ad18eaa9a40aa1d3574243d 100644 |
--- a/gm/shadertext2.cpp |
+++ b/gm/shadertext2.cpp |
@@ -4,12 +4,11 @@ |
* Use of this source code is governed by a BSD-style license that can be |
* found in the LICENSE file. |
*/ |
+ |
#include "gm.h" |
#include "SkCanvas.h" |
#include "SkGradientShader.h" |
-namespace skiagm { |
- |
static void makebm(SkBitmap* bm, int w, int h) { |
bm->allocN32Pixels(w, h); |
bm->eraseColor(SK_ColorTRANSPARENT); |
@@ -40,17 +39,23 @@ struct LabeledMatrix { |
const char* fLabel; |
}; |
-class ShaderText2GM : public GM { |
+class ShaderText2GM : public skiagm::GM { |
+ SkCanvas::TextOnPathMethod fMethod; |
+ SkString fName; |
+ |
public: |
- ShaderText2GM() { |
+ ShaderText2GM(SkCanvas::TextOnPathMethod method) : fMethod(method) { |
this->setBGColor(0xFFDDDDDD); |
+ |
+ fName.set("shadertext2"); |
+ if (SkCanvas::kAlign_TextOnPathMethod == fMethod) { |
+ fName.append("_align"); |
+ } |
} |
protected: |
- SkString onShortName() SK_OVERRIDE { |
- return SkString("shadertext2"); |
- } |
+ SkString onShortName() SK_OVERRIDE { return fName; } |
SkISize onISize() SK_OVERRIDE { return SkISize::Make(1800, 900); } |
@@ -174,8 +179,8 @@ protected: |
canvas->save(); |
canvas->concat(matrices[m].fMatrix); |
- canvas->drawTextOnPath(kText, kTextLen, path, NULL, paint); |
- canvas->drawTextOnPath(kText, kTextLen, path, NULL, outlinePaint); |
+ canvas->drawTextOnPath(kText, kTextLen, path, NULL, fMethod, paint); |
+ canvas->drawTextOnPath(kText, kTextLen, path, NULL, fMethod, outlinePaint); |
canvas->restore(); |
SkPaint stroke; |
stroke.setStyle(SkPaint::kStroke_Style); |
@@ -200,11 +205,8 @@ protected: |
} |
private: |
- typedef GM INHERITED; |
+ typedef skiagm::GM INHERITED; |
}; |
-/////////////////////////////////////////////////////////////////////////////// |
- |
-static GM* MyFactory(void*) { return new ShaderText2GM; } |
-static GMRegistry reg(MyFactory); |
-} |
+DEF_GM( return new ShaderText2GM(SkCanvas::kAlign_TextOnPathMethod); ) |
+DEF_GM( return new ShaderText2GM(SkCanvas::kStretch_TextOnPathMethod); ) |