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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | include/core/SkCanvas.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkRSXform.h" 10 #include "SkRSXform.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 canvas->drawAtlas(fAtlas.get(), xform, tex, N, nullptr, &paint); 94 canvas->drawAtlas(fAtlas.get(), xform, tex, N, nullptr, &paint);
95 canvas->translate(0, 100); 95 canvas->translate(0, 100);
96 canvas->drawAtlas(fAtlas.get(), xform, tex, colors, N, SkXfermode::kSrcI n_Mode, nullptr, &paint); 96 canvas->drawAtlas(fAtlas.get(), xform, tex, colors, N, SkXfermode::kSrcI n_Mode, nullptr, &paint);
97 } 97 }
98 98
99 private: 99 private:
100 typedef GM INHERITED; 100 typedef GM INHERITED;
101 }; 101 };
102 DEF_GM( return new DrawAtlasGM; ) 102 DEF_GM( return new DrawAtlasGM; )
103
104 //////////////////////////////////////////////////////////////////////////////// ///////////////////
105
106 DEF_SIMPLE_GM(drawTextRSXform, canvas, 1000, 1000) {
107 const char text[] = "ABCDFGHJKLMNOPQRSTUVWXYZ";
108 const int N = sizeof(text) - 1;
109 SkRSXform xform[N];
110
111 canvas->translate(0, 30);
112
113 SkScalar x = 20;
114 SkScalar dx = 20;
115 SkScalar rad = 0;
116 SkScalar drad = 2 * SK_ScalarPI / N;
117 for (int i = 0; i < N; ++i) {
118 xform[i].fSCos = SkScalarCos(rad);
119 xform[i].fSSin = SkScalarSin(rad);
120 xform[i].fTx = x;
121 xform[i].fTy = 0;
122 x += dx;
123 rad += drad;
124 }
125
126 SkPaint paint;
127 paint.setAntiAlias(true);
128 paint.setTextSize(20);
129 canvas->drawTextRSXform(text, N, xform, paint);
130 }
131
132
OLDNEW
« 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