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

Unified Diff: gm/shadertext2.cpp

Issue 933483002: add Method param to drawTextOnPath, supporting SVG spec Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 10 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/shadertext.cpp ('k') | gyp/skia_for_android_framework_defines.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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); )
« no previous file with comments | « gm/shadertext.cpp ('k') | gyp/skia_for_android_framework_defines.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698