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

Side by Side Diff: gm/emptypath.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/dropshadowimagefilter.cpp ('k') | gm/filterbitmap.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 }; 56 };
57 static const StyleAndName gStyles[] = { 57 static const StyleAndName gStyles[] = {
58 {SkPaint::kFill_Style, "Fill"}, 58 {SkPaint::kFill_Style, "Fill"},
59 {SkPaint::kStroke_Style, "Stroke"}, 59 {SkPaint::kStroke_Style, "Stroke"},
60 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"}, 60 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"},
61 }; 61 };
62 62
63 SkPaint titlePaint; 63 SkPaint titlePaint;
64 titlePaint.setColor(SK_ColorBLACK); 64 titlePaint.setColor(SK_ColorBLACK);
65 titlePaint.setAntiAlias(true); 65 titlePaint.setAntiAlias(true);
66 sk_tool_utils::set_portable_typeface(&titlePaint);
66 titlePaint.setLCDRenderText(true); 67 titlePaint.setLCDRenderText(true);
67 titlePaint.setTextSize(15 * SK_Scalar1); 68 titlePaint.setTextSize(15 * SK_Scalar1);
68 const char title[] = "Empty Paths Drawn Into Rectangle Clips With " 69 const char title[] = "Empty Paths Drawn Into Rectangle Clips With "
69 "Indicated Style and Fill"; 70 "Indicated Style and Fill";
70 canvas->drawText(title, strlen(title), 71 canvas->drawText(title, strlen(title),
71 20 * SK_Scalar1, 72 20 * SK_Scalar1,
72 20 * SK_Scalar1, 73 20 * SK_Scalar1,
73 titlePaint); 74 titlePaint);
74 75
75 SkLCGRandom rand; 76 SkLCGRandom rand;
(...skipping 22 matching lines...) Expand all
98 SkPaint rectPaint; 99 SkPaint rectPaint;
99 rectPaint.setColor(SK_ColorBLACK); 100 rectPaint.setColor(SK_ColorBLACK);
100 rectPaint.setStyle(SkPaint::kStroke_Style); 101 rectPaint.setStyle(SkPaint::kStroke_Style);
101 rectPaint.setStrokeWidth(-1); 102 rectPaint.setStrokeWidth(-1);
102 rectPaint.setAntiAlias(true); 103 rectPaint.setAntiAlias(true);
103 canvas->drawRect(rect, rectPaint); 104 canvas->drawRect(rect, rectPaint);
104 105
105 SkPaint labelPaint; 106 SkPaint labelPaint;
106 labelPaint.setColor(color); 107 labelPaint.setColor(color);
107 labelPaint.setAntiAlias(true); 108 labelPaint.setAntiAlias(true);
109 sk_tool_utils::set_portable_typeface(&labelPaint);
108 labelPaint.setLCDRenderText(true); 110 labelPaint.setLCDRenderText(true);
109 labelPaint.setTextSize(12 * SK_Scalar1); 111 labelPaint.setTextSize(12 * SK_Scalar1);
110 canvas->drawText(gStyles[style].fName, 112 canvas->drawText(gStyles[style].fName,
111 strlen(gStyles[style].fName), 113 strlen(gStyles[style].fName),
112 0, rect.height() + 15 * SK_Scalar1, 114 0, rect.height() + 15 * SK_Scalar1,
113 labelPaint); 115 labelPaint);
114 canvas->drawText(gFills[fill].fName, 116 canvas->drawText(gFills[fill].fName,
115 strlen(gFills[fill].fName), 117 strlen(gFills[fill].fName),
116 0, rect.height() + 28 * SK_Scalar1, 118 0, rect.height() + 28 * SK_Scalar1,
117 labelPaint); 119 labelPaint);
118 } 120 }
119 } 121 }
120 canvas->restore(); 122 canvas->restore();
121 canvas->restore(); 123 canvas->restore();
122 } 124 }
123 125
124 private: 126 private:
125 typedef GM INHERITED; 127 typedef GM INHERITED;
126 }; 128 };
127 129
128 ////////////////////////////////////////////////////////////////////////////// 130 //////////////////////////////////////////////////////////////////////////////
129 131
130 static GM* MyFactory(void*) { return new EmptyPathGM; } 132 static GM* MyFactory(void*) { return new EmptyPathGM; }
131 static GMRegistry reg(MyFactory); 133 static GMRegistry reg(MyFactory);
132 134
133 } 135 }
OLDNEW
« no previous file with comments | « gm/dropshadowimagefilter.cpp ('k') | gm/filterbitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698