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

Unified Diff: samplecode/SampleSlides.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 | « samplecode/SampleShaderText.cpp ('k') | samplecode/SampleTextOnPath.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleSlides.cpp
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp
index e115235ffa3e5b99de901466be0dca7164bceb49..bd33c811a910d2a250f337b5a7368bd14e966720 100644
--- a/samplecode/SampleSlides.cpp
+++ b/samplecode/SampleSlides.cpp
@@ -265,16 +265,19 @@ static void textonpath_slide(SkCanvas* canvas) {
canvas->drawPath(path, paint);
paint.setStyle(SkPaint::kFill_Style);
+ SkCanvas::TextOnPathMethod method = SkCanvas::kStretch_TextOnPathMethod;
+ SkMatrix matrix;
+
SkScalar x = 50;
paint.setColor(0xFF008800);
- canvas->drawTextOnPathHV(text, len, path,
- x, paint.getTextSize()*2/3, paint);
+ matrix.setTranslate(x, paint.getTextSize()*2/3);
+ canvas->drawTextOnPath(text, len, path, &matrix, method, paint);
paint.setColor(SK_ColorRED);
- canvas->drawTextOnPathHV(text, len, path,
- x + 60, 0, paint);
+ matrix.setTranslate(x + 60, 0);
+ canvas->drawTextOnPath(text, len, path, &matrix, method, paint);
paint.setColor(SK_ColorBLUE);
- canvas->drawTextOnPathHV(text, len, path,
- x + 120, -paint.getTextSize()*2/3, paint);
+ matrix.setTranslate(x + 120, -paint.getTextSize()*2/3);
+ canvas->drawTextOnPath(text, len, path, &matrix, method, paint);
path.offset(0, 200);
paint.setTextAlign(SkPaint::kRight_Align);
@@ -282,7 +285,6 @@ static void textonpath_slide(SkCanvas* canvas) {
text = "Matrices";
len = strlen(text);
SkScalar pathLen = getpathlen(path);
- SkMatrix matrix;
paint.setColor(SK_ColorBLACK);
paint.setStyle(SkPaint::kStroke_Style);
@@ -290,21 +292,21 @@ static void textonpath_slide(SkCanvas* canvas) {
paint.setStyle(SkPaint::kFill_Style);
paint.setTextSize(50);
- canvas->drawTextOnPath(text, len, path, NULL, paint);
+ canvas->drawTextOnPath(text, len, path, NULL, method, paint);
paint.setColor(SK_ColorRED);
matrix.setScale(-SK_Scalar1, SK_Scalar1);
matrix.postTranslate(pathLen, 0);
- canvas->drawTextOnPath(text, len, path, &matrix, paint);
+ canvas->drawTextOnPath(text, len, path, &matrix, method, paint);
paint.setColor(SK_ColorBLUE);
matrix.setScale(SK_Scalar1, -SK_Scalar1);
- canvas->drawTextOnPath(text, len, path, &matrix, paint);
+ canvas->drawTextOnPath(text, len, path, &matrix, method, paint);
paint.setColor(0xFF008800);
matrix.setScale(-SK_Scalar1, -SK_Scalar1);
matrix.postTranslate(pathLen, 0);
- canvas->drawTextOnPath(text, len, path, &matrix, paint);
+ canvas->drawTextOnPath(text, len, path, &matrix, method, paint);
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « samplecode/SampleShaderText.cpp ('k') | samplecode/SampleTextOnPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698