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

Side by Side Diff: gm/cubicpaths.cpp

Issue 348323003: use platform-independent font for gm (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add include tools for skimage Created 6 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 | « gm/convexpolyclip.cpp ('k') | gm/degeneratesegments.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 #include "gm.h" 7 #include "gm.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 PathAndName path; 123 PathAndName path;
124 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); 124 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1);
125 path.fPath.cubicTo(40*SK_Scalar1, 20*SK_Scalar1, 125 path.fPath.cubicTo(40*SK_Scalar1, 20*SK_Scalar1,
126 60*SK_Scalar1, 20*SK_Scalar1, 126 60*SK_Scalar1, 20*SK_Scalar1,
127 75*SK_Scalar1, 10*SK_Scalar1); 127 75*SK_Scalar1, 10*SK_Scalar1);
128 path.fName = "moveTo-cubic"; 128 path.fName = "moveTo-cubic";
129 129
130 SkPaint titlePaint; 130 SkPaint titlePaint;
131 titlePaint.setColor(SK_ColorBLACK); 131 titlePaint.setColor(SK_ColorBLACK);
132 titlePaint.setAntiAlias(true); 132 titlePaint.setAntiAlias(true);
133 sk_tool_utils::set_portable_typeface(&titlePaint);
133 titlePaint.setLCDRenderText(true); 134 titlePaint.setLCDRenderText(true);
134 titlePaint.setTextSize(15 * SK_Scalar1); 135 titlePaint.setTextSize(15 * SK_Scalar1);
135 const char title[] = "Cubic Drawn Into Rectangle Clips With " 136 const char title[] = "Cubic Drawn Into Rectangle Clips With "
136 "Indicated Style, Fill and Linecaps, with stroke wi dth 10"; 137 "Indicated Style, Fill and Linecaps, with stroke wi dth 10";
137 canvas->drawText(title, strlen(title), 138 canvas->drawText(title, strlen(title),
138 20 * SK_Scalar1, 139 20 * SK_Scalar1,
139 20 * SK_Scalar1, 140 20 * SK_Scalar1,
140 titlePaint); 141 titlePaint);
141 142
142 SkLCGRandom rand; 143 SkLCGRandom rand;
(...skipping 24 matching lines...) Expand all
167 SkPaint rectPaint; 168 SkPaint rectPaint;
168 rectPaint.setColor(SK_ColorBLACK); 169 rectPaint.setColor(SK_ColorBLACK);
169 rectPaint.setStyle(SkPaint::kStroke_Style); 170 rectPaint.setStyle(SkPaint::kStroke_Style);
170 rectPaint.setStrokeWidth(-1); 171 rectPaint.setStrokeWidth(-1);
171 rectPaint.setAntiAlias(true); 172 rectPaint.setAntiAlias(true);
172 canvas->drawRect(rect, rectPaint); 173 canvas->drawRect(rect, rectPaint);
173 174
174 SkPaint labelPaint; 175 SkPaint labelPaint;
175 labelPaint.setColor(color); 176 labelPaint.setColor(color);
176 labelPaint.setAntiAlias(true); 177 labelPaint.setAntiAlias(true);
178 sk_tool_utils::set_portable_typeface(&labelPaint);
177 labelPaint.setLCDRenderText(true); 179 labelPaint.setLCDRenderText(true);
178 labelPaint.setTextSize(10 * SK_Scalar1); 180 labelPaint.setTextSize(10 * SK_Scalar1);
179 canvas->drawText(gStyles[style].fName, 181 canvas->drawText(gStyles[style].fName,
180 strlen(gStyles[style].fName), 182 strlen(gStyles[style].fName),
181 0, rect.height() + 12 * SK_Scalar1, 183 0, rect.height() + 12 * SK_Scalar1,
182 labelPaint); 184 labelPaint);
183 canvas->drawText(gFills[fill].fName, 185 canvas->drawText(gFills[fill].fName,
184 strlen(gFills[fill].fName), 186 strlen(gFills[fill].fName),
185 0, rect.height() + 24 * SK_Scalar1, 187 0, rect.height() + 24 * SK_Scalar1,
186 labelPaint); 188 labelPaint);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 349
348 private: 350 private:
349 typedef skiagm::GM INHERITED; 351 typedef skiagm::GM INHERITED;
350 }; 352 };
351 353
352 ////////////////////////////////////////////////////////////////////////////// 354 //////////////////////////////////////////////////////////////////////////////
353 355
354 DEF_GM( return new CubicPathGM; ) 356 DEF_GM( return new CubicPathGM; )
355 DEF_GM( return new CubicClosePathGM; ) 357 DEF_GM( return new CubicClosePathGM; )
356 DEF_GM( return new ClippedCubicGM; ) 358 DEF_GM( return new ClippedCubicGM; )
OLDNEW
« no previous file with comments | « gm/convexpolyclip.cpp ('k') | gm/degeneratesegments.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698