OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 | 9 |
10 #include "Sk2DPathEffect.h" | 10 #include "Sk2DPathEffect.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void onOnceBeforeDraw() override { | 141 void onOnceBeforeDraw() override { |
142 SkTextBlobBuilder builder; | 142 SkTextBlobBuilder builder; |
143 | 143 |
144 // LCD | 144 // LCD |
145 SkPaint paint; | 145 SkPaint paint; |
146 paint.setTextSize(32); | 146 paint.setTextSize(32); |
147 const char* text = "The quick brown fox jumps over the lazy dog"; | 147 const char* text = "The quick brown fox jumps over the lazy dog"; |
148 paint.setSubpixelText(true); | 148 paint.setSubpixelText(true); |
149 paint.setLCDRenderText(true); | 149 paint.setLCDRenderText(true); |
150 paint.setAntiAlias(true); | 150 paint.setAntiAlias(true); |
| 151 sk_tool_utils::set_portable_typeface(&paint); |
151 add_to_text_blob(&builder, text, paint, 0, 0); | 152 add_to_text_blob(&builder, text, paint, 0, 0); |
152 fBlob.reset(builder.build()); | 153 fBlob.reset(builder.build()); |
153 | 154 |
154 // create a looper which sandwhiches an effect in two normal draws | 155 // create a looper which sandwhiches an effect in two normal draws |
155 LooperSettings looperSandwhich[] = { | 156 LooperSettings looperSandwhich[] = { |
156 { SkXfermode::kSrc_Mode, SK_ColorMAGENTA, SkPaint::kFill_Style, 0, 0,
0, false }, | 157 { SkXfermode::kSrc_Mode, SK_ColorMAGENTA, SkPaint::kFill_Style, 0, 0,
0, false }, |
157 { SkXfermode::kSrcOver_Mode, 0x88000000, SkPaint::kFill_Style, 0, 10.
f, 0, true }, | 158 { SkXfermode::kSrcOver_Mode, 0x88000000, SkPaint::kFill_Style, 0, 10.
f, 0, true }, |
158 { SkXfermode::kSrcOver_Mode, 0x50FF00FF, SkPaint::kFill_Style, 0, 20.
f, 0, false }, | 159 { SkXfermode::kSrcOver_Mode, 0x50FF00FF, SkPaint::kFill_Style, 0, 20.
f, 0, false }, |
159 }; | 160 }; |
160 | 161 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 SkString onShortName() override { | 219 SkString onShortName() override { |
219 return SkString("textbloblooper"); | 220 return SkString("textbloblooper"); |
220 } | 221 } |
221 | 222 |
222 SkISize onISize() override { | 223 SkISize onISize() override { |
223 return SkISize::Make(kWidth, kHeight); | 224 return SkISize::Make(kWidth, kHeight); |
224 } | 225 } |
225 | 226 |
226 void onDraw(SkCanvas* canvas) override { | 227 void onDraw(SkCanvas* canvas) override { |
227 | 228 |
228 canvas->drawColor(SK_ColorGRAY); | 229 canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorGRAY)); |
229 | 230 |
230 SkPaint paint; | 231 SkPaint paint; |
231 canvas->translate(10, 40); | 232 canvas->translate(10, 40); |
232 | 233 |
233 paint.setTextSize(40); | 234 paint.setTextSize(40); |
234 | 235 |
235 SkRect bounds = fBlob->bounds(); | 236 SkRect bounds = fBlob->bounds(); |
236 | 237 |
237 int y = 0; | 238 int y = 0; |
238 for (int looper = 0; looper < fLoopers.count(); looper++) { | 239 for (int looper = 0; looper < fLoopers.count(); looper++) { |
(...skipping 10 matching lines...) Expand all Loading... |
249 SkAutoTUnref<const SkTextBlob> fBlob; | 250 SkAutoTUnref<const SkTextBlob> fBlob; |
250 SkTArray<SkAutoTUnref<SkLayerDrawLooper>, true> fLoopers; | 251 SkTArray<SkAutoTUnref<SkLayerDrawLooper>, true> fLoopers; |
251 | 252 |
252 typedef GM INHERITED; | 253 typedef GM INHERITED; |
253 }; | 254 }; |
254 | 255 |
255 ////////////////////////////////////////////////////////////////////////////// | 256 ////////////////////////////////////////////////////////////////////////////// |
256 | 257 |
257 DEF_GM( return SkNEW(TextBlobLooperGM); ) | 258 DEF_GM( return SkNEW(TextBlobLooperGM); ) |
258 } | 259 } |
OLD | NEW |