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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 static const char* gModeNames[] = { "C",
"R", "M" }; | 93 static const char* gModeNames[] = { "C",
"R", "M" }; |
94 | 94 |
95 SkScalar y = SkIntToScalar(24); | 95 SkScalar y = SkIntToScalar(24); |
96 SkScalar x = SkIntToScalar(10); | 96 SkScalar x = SkIntToScalar(10); |
97 | 97 |
98 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { | 98 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { |
99 for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) { | 99 for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) { |
100 SkPaint p; | 100 SkPaint p; |
101 SkString str; | 101 SkString str; |
102 p.setAntiAlias(true); | 102 p.setAntiAlias(true); |
| 103 sk_tool_utils::set_portable_typeface(&p); |
103 p.setDither(true); | 104 p.setDither(true); |
104 str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]); | 105 str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]); |
105 | 106 |
106 p.setTextAlign(SkPaint::kCenter_Align); | 107 p.setTextAlign(SkPaint::kCenter_Align); |
107 canvas->drawText(str.c_str(), str.size(), x + r.width()/2, y, p)
; | 108 canvas->drawText(str.c_str(), str.size(), x + r.width()/2, y, p)
; |
108 | 109 |
109 x += r.width() * 4 / 3; | 110 x += r.width() * 4 / 3; |
110 } | 111 } |
111 } | 112 } |
112 | 113 |
(...skipping 19 matching lines...) Expand all Loading... |
132 canvas->drawRect(r, paint); | 133 canvas->drawRect(r, paint); |
133 canvas->restore(); | 134 canvas->restore(); |
134 | 135 |
135 x += r.width() * 4 / 3; | 136 x += r.width() * 4 / 3; |
136 } | 137 } |
137 } | 138 } |
138 { | 139 { |
139 SkPaint p; | 140 SkPaint p; |
140 SkString str; | 141 SkString str; |
141 p.setAntiAlias(true); | 142 p.setAntiAlias(true); |
| 143 sk_tool_utils::set_portable_typeface(&p); |
142 str.printf("%s, %s", gConfigNames[i], gFilterNames[j]); | 144 str.printf("%s, %s", gConfigNames[i], gFilterNames[j]); |
143 canvas->drawText(str.c_str(), str.size(), x, y + r.height()
* 2 / 3, p); | 145 canvas->drawText(str.c_str(), str.size(), x, y + r.height()
* 2 / 3, p); |
144 } | 146 } |
145 | 147 |
146 y += r.height() * 4 / 3; | 148 y += r.height() * 4 / 3; |
147 } | 149 } |
148 } | 150 } |
149 } | 151 } |
150 | 152 |
151 private: | 153 private: |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 }; | 216 }; |
215 static const char* gModeNames[] = { | 217 static const char* gModeNames[] = { |
216 "Clamp", "Repeat", "Mirror" | 218 "Clamp", "Repeat", "Mirror" |
217 }; | 219 }; |
218 | 220 |
219 SkScalar y = SkIntToScalar(24); | 221 SkScalar y = SkIntToScalar(24); |
220 SkScalar x = SkIntToScalar(66); | 222 SkScalar x = SkIntToScalar(66); |
221 | 223 |
222 SkPaint p; | 224 SkPaint p; |
223 p.setAntiAlias(true); | 225 p.setAntiAlias(true); |
| 226 sk_tool_utils::set_portable_typeface(&p); |
224 p.setTextAlign(SkPaint::kCenter_Align); | 227 p.setTextAlign(SkPaint::kCenter_Align); |
225 | 228 |
226 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { | 229 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { |
227 SkString str(gModeNames[kx]); | 230 SkString str(gModeNames[kx]); |
228 canvas->drawText(str.c_str(), str.size(), x + r.width()/2, y, p); | 231 canvas->drawText(str.c_str(), str.size(), x + r.width()/2, y, p); |
229 x += r.width() * 4 / 3; | 232 x += r.width() * 4 / 3; |
230 } | 233 } |
231 | 234 |
232 y += SkIntToScalar(16) + h; | 235 y += SkIntToScalar(16) + h; |
233 p.setTextAlign(SkPaint::kRight_Align); | 236 p.setTextAlign(SkPaint::kRight_Align); |
(...skipping 23 matching lines...) Expand all Loading... |
257 private: | 260 private: |
258 typedef skiagm::GM INHERITED; | 261 typedef skiagm::GM INHERITED; |
259 }; | 262 }; |
260 | 263 |
261 ////////////////////////////////////////////////////////////////////////////// | 264 ////////////////////////////////////////////////////////////////////////////// |
262 | 265 |
263 DEF_GM( return new TilingGM(true); ) | 266 DEF_GM( return new TilingGM(true); ) |
264 DEF_GM( return new TilingGM(false); ) | 267 DEF_GM( return new TilingGM(false); ) |
265 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) | 268 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) |
266 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) | 269 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) |
OLD | NEW |