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

Side by Side Diff: gm/linepaths.cpp

Issue 407183003: add portable and canonical font support for DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add atexit; rename to create_... Created 6 years, 4 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/lighting.cpp ('k') | gm/lumafilter.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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const char* fName; 78 const char* fName;
79 }; 79 };
80 PathAndName path; 80 PathAndName path;
81 path.fPath.moveTo(25*SK_Scalar1, 15*SK_Scalar1); 81 path.fPath.moveTo(25*SK_Scalar1, 15*SK_Scalar1);
82 path.fPath.lineTo(75*SK_Scalar1, 15*SK_Scalar1); 82 path.fPath.lineTo(75*SK_Scalar1, 15*SK_Scalar1);
83 path.fName = "moveTo-line"; 83 path.fName = "moveTo-line";
84 84
85 SkPaint titlePaint; 85 SkPaint titlePaint;
86 titlePaint.setColor(SK_ColorBLACK); 86 titlePaint.setColor(SK_ColorBLACK);
87 titlePaint.setAntiAlias(true); 87 titlePaint.setAntiAlias(true);
88 sk_tool_utils::set_portable_typeface(&titlePaint);
88 titlePaint.setLCDRenderText(true); 89 titlePaint.setLCDRenderText(true);
89 titlePaint.setTextSize(15 * SK_Scalar1); 90 titlePaint.setTextSize(15 * SK_Scalar1);
90 const char title[] = "Line Drawn Into Rectangle Clips With " 91 const char title[] = "Line Drawn Into Rectangle Clips With "
91 "Indicated Style, Fill and Linecaps, with stroke wi dth 10"; 92 "Indicated Style, Fill and Linecaps, with stroke wi dth 10";
92 canvas->drawText(title, strlen(title), 93 canvas->drawText(title, strlen(title),
93 20 * SK_Scalar1, 94 20 * SK_Scalar1,
94 20 * SK_Scalar1, 95 20 * SK_Scalar1,
95 titlePaint); 96 titlePaint);
96 97
97 SkLCGRandom rand; 98 SkLCGRandom rand;
(...skipping 24 matching lines...) Expand all
122 SkPaint rectPaint; 123 SkPaint rectPaint;
123 rectPaint.setColor(SK_ColorBLACK); 124 rectPaint.setColor(SK_ColorBLACK);
124 rectPaint.setStyle(SkPaint::kStroke_Style); 125 rectPaint.setStyle(SkPaint::kStroke_Style);
125 rectPaint.setStrokeWidth(-1); 126 rectPaint.setStrokeWidth(-1);
126 rectPaint.setAntiAlias(true); 127 rectPaint.setAntiAlias(true);
127 canvas->drawRect(rect, rectPaint); 128 canvas->drawRect(rect, rectPaint);
128 129
129 SkPaint labelPaint; 130 SkPaint labelPaint;
130 labelPaint.setColor(color); 131 labelPaint.setColor(color);
131 labelPaint.setAntiAlias(true); 132 labelPaint.setAntiAlias(true);
133 sk_tool_utils::set_portable_typeface(&labelPaint);
132 labelPaint.setLCDRenderText(true); 134 labelPaint.setLCDRenderText(true);
133 labelPaint.setTextSize(10 * SK_Scalar1); 135 labelPaint.setTextSize(10 * SK_Scalar1);
134 canvas->drawText(gStyles[style].fName, 136 canvas->drawText(gStyles[style].fName,
135 strlen(gStyles[style].fName), 137 strlen(gStyles[style].fName),
136 0, rect.height() + 12 * SK_Scalar1, 138 0, rect.height() + 12 * SK_Scalar1,
137 labelPaint); 139 labelPaint);
138 canvas->drawText(gFills[fill].fName, 140 canvas->drawText(gFills[fill].fName,
139 strlen(gFills[fill].fName), 141 strlen(gFills[fill].fName),
140 0, rect.height() + 24 * SK_Scalar1, 142 0, rect.height() + 24 * SK_Scalar1,
141 labelPaint); 143 labelPaint);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 }; 222 };
221 PathAndName path; 223 PathAndName path;
222 path.fPath.moveTo(25*SK_Scalar1, 15*SK_Scalar1); 224 path.fPath.moveTo(25*SK_Scalar1, 15*SK_Scalar1);
223 path.fPath.lineTo(75*SK_Scalar1, 15*SK_Scalar1); 225 path.fPath.lineTo(75*SK_Scalar1, 15*SK_Scalar1);
224 path.fPath.close(); 226 path.fPath.close();
225 path.fName = "moveTo-line-close"; 227 path.fName = "moveTo-line-close";
226 228
227 SkPaint titlePaint; 229 SkPaint titlePaint;
228 titlePaint.setColor(SK_ColorBLACK); 230 titlePaint.setColor(SK_ColorBLACK);
229 titlePaint.setAntiAlias(true); 231 titlePaint.setAntiAlias(true);
232 sk_tool_utils::set_portable_typeface(&titlePaint);
230 titlePaint.setLCDRenderText(true); 233 titlePaint.setLCDRenderText(true);
231 titlePaint.setTextSize(15 * SK_Scalar1); 234 titlePaint.setTextSize(15 * SK_Scalar1);
232 const char title[] = "Line Closed Drawn Into Rectangle Clips With " 235 const char title[] = "Line Closed Drawn Into Rectangle Clips With "
233 "Indicated Style, Fill and Linecaps, with stroke wi dth 10"; 236 "Indicated Style, Fill and Linecaps, with stroke wi dth 10";
234 canvas->drawText(title, strlen(title), 237 canvas->drawText(title, strlen(title),
235 20 * SK_Scalar1, 238 20 * SK_Scalar1,
236 20 * SK_Scalar1, 239 20 * SK_Scalar1,
237 titlePaint); 240 titlePaint);
238 241
239 SkLCGRandom rand; 242 SkLCGRandom rand;
(...skipping 24 matching lines...) Expand all
264 SkPaint rectPaint; 267 SkPaint rectPaint;
265 rectPaint.setColor(SK_ColorBLACK); 268 rectPaint.setColor(SK_ColorBLACK);
266 rectPaint.setStyle(SkPaint::kStroke_Style); 269 rectPaint.setStyle(SkPaint::kStroke_Style);
267 rectPaint.setStrokeWidth(-1); 270 rectPaint.setStrokeWidth(-1);
268 rectPaint.setAntiAlias(true); 271 rectPaint.setAntiAlias(true);
269 canvas->drawRect(rect, rectPaint); 272 canvas->drawRect(rect, rectPaint);
270 273
271 SkPaint labelPaint; 274 SkPaint labelPaint;
272 labelPaint.setColor(color); 275 labelPaint.setColor(color);
273 labelPaint.setAntiAlias(true); 276 labelPaint.setAntiAlias(true);
277 sk_tool_utils::set_portable_typeface(&labelPaint);
274 labelPaint.setLCDRenderText(true); 278 labelPaint.setLCDRenderText(true);
275 labelPaint.setTextSize(10 * SK_Scalar1); 279 labelPaint.setTextSize(10 * SK_Scalar1);
276 canvas->drawText(gStyles[style].fName, 280 canvas->drawText(gStyles[style].fName,
277 strlen(gStyles[style].fName), 281 strlen(gStyles[style].fName),
278 0, rect.height() + 12 * SK_Scalar1, 282 0, rect.height() + 12 * SK_Scalar1,
279 labelPaint); 283 labelPaint);
280 canvas->drawText(gFills[fill].fName, 284 canvas->drawText(gFills[fill].fName,
281 strlen(gFills[fill].fName), 285 strlen(gFills[fill].fName),
282 0, rect.height() + 24 * SK_Scalar1, 286 0, rect.height() + 24 * SK_Scalar1,
283 labelPaint); 287 labelPaint);
(...skipping 16 matching lines...) Expand all
300 304
301 ////////////////////////////////////////////////////////////////////////////// 305 //////////////////////////////////////////////////////////////////////////////
302 306
303 static GM* LinePathFactory(void*) { return new LinePathGM; } 307 static GM* LinePathFactory(void*) { return new LinePathGM; }
304 static GMRegistry regLinePath(LinePathFactory); 308 static GMRegistry regLinePath(LinePathFactory);
305 309
306 static GM* LineClosePathFactory(void*) { return new LineClosePathGM; } 310 static GM* LineClosePathFactory(void*) { return new LineClosePathGM; }
307 static GMRegistry regLineClosePath(LineClosePathFactory); 311 static GMRegistry regLineClosePath(LineClosePathFactory);
308 312
309 } 313 }
OLDNEW
« no previous file with comments | « gm/lighting.cpp ('k') | gm/lumafilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698