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

Unified Diff: gm/drawatlas.cpp

Issue 2130643004: drawTextRSXform (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | include/core/SkCanvas.h » ('j') | include/core/SkCanvas.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/drawatlas.cpp
diff --git a/gm/drawatlas.cpp b/gm/drawatlas.cpp
index a906cbedeba9f2a97f80dbbbeb92321afb7ce91a..d8b77774940bab93144856c7d7ec34d41b93933f 100644
--- a/gm/drawatlas.cpp
+++ b/gm/drawatlas.cpp
@@ -100,3 +100,33 @@ private:
typedef GM INHERITED;
};
DEF_GM( return new DrawAtlasGM; )
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+DEF_SIMPLE_GM(drawTextRSXform, canvas, 1000, 1000) {
+ const char text[] = "ABCDFGHJKLMNOPQRSTUVWXYZ";
+ const int N = sizeof(text) - 1;
+ SkRSXform xform[N];
+
+ canvas->translate(0, 30);
+
+ SkScalar x = 20;
+ SkScalar dx = 20;
+ SkScalar rad = 0;
+ SkScalar drad = 2 * SK_ScalarPI / N;
+ for (int i = 0; i < N; ++i) {
+ xform[i].fSCos = SkScalarCos(rad);
+ xform[i].fSSin = SkScalarSin(rad);
+ xform[i].fTx = x;
+ xform[i].fTy = 0;
+ x += dx;
+ rad += drad;
+ }
+
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextSize(20);
+ canvas->drawTextRSXform(text, N, xform, paint);
+}
+
+
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | include/core/SkCanvas.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698