OLD | NEW |
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 "SkPath.h" | 9 #include "SkPath.h" |
10 #include "SkRegion.h" | 10 #include "SkRegion.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 static const char* gModeNames[] = { "C",
"R", "M" }; | 103 static const char* gModeNames[] = { "C",
"R", "M" }; |
104 | 104 |
105 SkScalar y = SkIntToScalar(24); | 105 SkScalar y = SkIntToScalar(24); |
106 SkScalar x = SkIntToScalar(10)/scale; | 106 SkScalar x = SkIntToScalar(10)/scale; |
107 | 107 |
108 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { | 108 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { |
109 for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) { | 109 for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) { |
110 SkPaint p; | 110 SkPaint p; |
111 SkString str; | 111 SkString str; |
112 p.setAntiAlias(true); | 112 p.setAntiAlias(true); |
| 113 sk_tool_utils::set_portable_typeface(&p); |
113 p.setDither(true); | 114 p.setDither(true); |
114 p.setLooper(fLooper); | 115 p.setLooper(fLooper); |
115 str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]); | 116 str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]); |
116 | 117 |
117 p.setTextAlign(SkPaint::kCenter_Align); | 118 p.setTextAlign(SkPaint::kCenter_Align); |
118 canvas->drawText(str.c_str(), str.size(), scale*(x + r.width()/2
), y, p); | 119 canvas->drawText(str.c_str(), str.size(), scale*(x + r.width()/2
), y, p); |
119 | 120 |
120 x += r.width() * 4 / 3; | 121 x += r.width() * 4 / 3; |
121 } | 122 } |
122 } | 123 } |
(...skipping 21 matching lines...) Expand all Loading... |
144 canvas->drawRect(r, paint); | 145 canvas->drawRect(r, paint); |
145 canvas->restore(); | 146 canvas->restore(); |
146 | 147 |
147 x += r.width() * 4 / 3; | 148 x += r.width() * 4 / 3; |
148 } | 149 } |
149 } | 150 } |
150 { | 151 { |
151 SkPaint p; | 152 SkPaint p; |
152 SkString str; | 153 SkString str; |
153 p.setAntiAlias(true); | 154 p.setAntiAlias(true); |
| 155 sk_tool_utils::set_portable_typeface(&p); |
154 p.setLooper(fLooper); | 156 p.setLooper(fLooper); |
155 str.printf("%s, %s", gColorTypeNames[i], gFilterNames[j]); | 157 str.printf("%s, %s", gColorTypeNames[i], gFilterNames[j]); |
156 canvas->drawText(str.c_str(), str.size(), scale*x, scale*(y
+ r.height() * 2 / 3), p); | 158 canvas->drawText(str.c_str(), str.size(), scale*x, scale*(y
+ r.height() * 2 / 3), p); |
157 } | 159 } |
158 | 160 |
159 y += r.height() * 4 / 3; | 161 y += r.height() * 4 / 3; |
160 } | 162 } |
161 } | 163 } |
162 } | 164 } |
163 | 165 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 }; | 229 }; |
228 static const char* gModeNames[] = { | 230 static const char* gModeNames[] = { |
229 "Clamp", "Repeat", "Mirror" | 231 "Clamp", "Repeat", "Mirror" |
230 }; | 232 }; |
231 | 233 |
232 SkScalar y = SkIntToScalar(24); | 234 SkScalar y = SkIntToScalar(24); |
233 SkScalar x = SkIntToScalar(66); | 235 SkScalar x = SkIntToScalar(66); |
234 | 236 |
235 SkPaint p; | 237 SkPaint p; |
236 p.setAntiAlias(true); | 238 p.setAntiAlias(true); |
| 239 sk_tool_utils::set_portable_typeface(&p); |
237 p.setTextAlign(SkPaint::kCenter_Align); | 240 p.setTextAlign(SkPaint::kCenter_Align); |
238 | 241 |
239 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { | 242 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { |
240 SkString str(gModeNames[kx]); | 243 SkString str(gModeNames[kx]); |
241 canvas->drawText(str.c_str(), str.size(), x + r.width()/2, y, p); | 244 canvas->drawText(str.c_str(), str.size(), x + r.width()/2, y, p); |
242 x += r.width() * 4 / 3; | 245 x += r.width() * 4 / 3; |
243 } | 246 } |
244 | 247 |
245 y += SkIntToScalar(16) + h; | 248 y += SkIntToScalar(16) + h; |
246 p.setTextAlign(SkPaint::kRight_Align); | 249 p.setTextAlign(SkPaint::kRight_Align); |
(...skipping 23 matching lines...) Expand all Loading... |
270 private: | 273 private: |
271 typedef skiagm::GM INHERITED; | 274 typedef skiagm::GM INHERITED; |
272 }; | 275 }; |
273 | 276 |
274 ////////////////////////////////////////////////////////////////////////////// | 277 ////////////////////////////////////////////////////////////////////////////// |
275 | 278 |
276 DEF_GM( return new ScaledTilingGM(true); ) | 279 DEF_GM( return new ScaledTilingGM(true); ) |
277 DEF_GM( return new ScaledTilingGM(false); ) | 280 DEF_GM( return new ScaledTilingGM(false); ) |
278 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); ) | 281 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); ) |
279 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); ) | 282 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); ) |
OLD | NEW |