OLD | NEW |
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 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 virtual SkISize onISize() SK_OVERRIDE { | 182 virtual SkISize onISize() SK_OVERRIDE { |
183 return SkISize::Make(460, 680); | 183 return SkISize::Make(460, 680); |
184 } | 184 } |
185 | 185 |
186 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 186 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
187 canvas->save(); | 187 canvas->save(); |
188 | 188 |
189 SkPaint paint; | 189 SkPaint paint; |
190 paint.setAntiAlias(true); | 190 paint.setAntiAlias(true); |
| 191 sk_tool_utils::set_portable_typeface(&paint); |
191 paint.setTextSize(SkIntToScalar(56)); | 192 paint.setTextSize(SkIntToScalar(56)); |
192 | 193 |
193 SkScalar x = SkIntToScalar(20); | 194 SkScalar x = SkIntToScalar(20); |
194 SkScalar y = paint.getTextSize(); | 195 SkScalar y = paint.getTextSize(); |
195 | 196 |
196 SkString str("Hamburgefons"); | 197 SkString str("Hamburgefons"); |
197 | 198 |
198 for (int i = 0; i < static_cast<int>(SK_ARRAY_COUNT(gRastProcs)); i++) { | 199 for (int i = 0; i < static_cast<int>(SK_ARRAY_COUNT(gRastProcs)); i++) { |
199 apply_shader(&paint, i); | 200 apply_shader(&paint, i); |
200 | 201 |
201 // paint.setMaskFilter(NULL); | 202 // paint.setMaskFilter(NULL); |
202 // paint.setColor(SK_ColorBLACK); | 203 // paint.setColor(SK_ColorBLACK); |
203 | 204 |
204 canvas->drawText(str.c_str(), str.size(), x, y, paint); | 205 canvas->drawText(str.c_str(), str.size(), x, y, paint); |
205 | 206 |
206 y += paint.getFontSpacing(); | 207 y += paint.getFontSpacing(); |
207 } | 208 } |
208 | 209 |
209 canvas->restore(); | 210 canvas->restore(); |
210 } | 211 } |
211 | 212 |
212 private: | 213 private: |
213 typedef skiagm::GM INHERITED; | 214 typedef skiagm::GM INHERITED; |
214 }; | 215 }; |
215 | 216 |
216 ////////////////////////////////////////////////////////////////////////////// | 217 ////////////////////////////////////////////////////////////////////////////// |
217 | 218 |
218 static skiagm::GM* MyFactory(void*) { return new TextEffectsGM; } | 219 static skiagm::GM* MyFactory(void*) { return new TextEffectsGM; } |
219 static skiagm::GMRegistry reg(MyFactory); | 220 static skiagm::GMRegistry reg(MyFactory); |
OLD | NEW |