| 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 | 141 |
| 142 // LCD | 142 // LCD |
| 143 SkPaint paint; | 143 SkPaint paint; |
| 144 paint.setTextSize(32); | 144 paint.setTextSize(32); |
| 145 const char* text = "The quick brown fox jumps over the lazy dog"; | 145 const char* text = "The quick brown fox jumps over the lazy dog"; |
| 146 paint.setSubpixelText(true); | 146 paint.setSubpixelText(true); |
| 147 paint.setLCDRenderText(true); | 147 paint.setLCDRenderText(true); |
| 148 paint.setAntiAlias(true); | 148 paint.setAntiAlias(true); |
| 149 sk_tool_utils::set_portable_typeface(&paint); | 149 sk_tool_utils::set_portable_typeface(&paint); |
| 150 add_to_text_blob(&builder, text, paint, 0, 0); | 150 add_to_text_blob(&builder, text, paint, 0, 0); |
| 151 fBlob.reset(builder.build()); | 151 fBlob = builder.make(); |
| 152 | 152 |
| 153 // create a looper which sandwhiches an effect in two normal draws | 153 // create a looper which sandwhiches an effect in two normal draws |
| 154 LooperSettings looperSandwhich[] = { | 154 LooperSettings looperSandwhich[] = { |
| 155 { SkXfermode::kSrc_Mode, SK_ColorMAGENTA, SkPaint::kFill_Style, 0, 0,
0, false }, | 155 { SkXfermode::kSrc_Mode, SK_ColorMAGENTA, SkPaint::kFill_Style, 0, 0,
0, false }, |
| 156 { SkXfermode::kSrcOver_Mode, 0x88000000, SkPaint::kFill_Style, 0, 10.
f, 0, true }, | 156 { SkXfermode::kSrcOver_Mode, 0x88000000, SkPaint::kFill_Style, 0, 10.
f, 0, true }, |
| 157 { SkXfermode::kSrcOver_Mode, 0x50FF00FF, SkPaint::kFill_Style, 0, 20.
f, 0, false }, | 157 { SkXfermode::kSrcOver_Mode, 0x50FF00FF, SkPaint::kFill_Style, 0, 20.
f, 0, false }, |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 LooperSettings compound[] = { | 160 LooperSettings compound[] = { |
| 161 { SkXfermode::kSrc_Mode, SK_ColorWHITE, SkPaint::kStroke_Style, 1.f
* 3/4, 0, 0, false }, | 161 { SkXfermode::kSrc_Mode, SK_ColorWHITE, SkPaint::kStroke_Style, 1.f
* 3/4, 0, 0, false }, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 paint.setLooper(fLoopers[looper]); | 238 paint.setLooper(fLoopers[looper]); |
| 239 canvas->save(); | 239 canvas->save(); |
| 240 canvas->translate(0, SkIntToScalar(y)); | 240 canvas->translate(0, SkIntToScalar(y)); |
| 241 canvas->drawTextBlob(fBlob, 0, 0, paint); | 241 canvas->drawTextBlob(fBlob, 0, 0, paint); |
| 242 canvas->restore(); | 242 canvas->restore(); |
| 243 y += SkScalarFloorToInt(bounds.height()); | 243 y += SkScalarFloorToInt(bounds.height()); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 private: | 247 private: |
| 248 SkAutoTUnref<const SkTextBlob> fBlob; | 248 sk_sp<SkTextBlob> fBlob; |
| 249 SkTArray<sk_sp<SkDrawLooper>, true> fLoopers; | 249 SkTArray<sk_sp<SkDrawLooper>, true> fLoopers; |
| 250 | 250 |
| 251 typedef GM INHERITED; | 251 typedef GM INHERITED; |
| 252 }; | 252 }; |
| 253 | 253 |
| 254 ////////////////////////////////////////////////////////////////////////////// | 254 ////////////////////////////////////////////////////////////////////////////// |
| 255 | 255 |
| 256 DEF_GM(return new TextBlobLooperGM;) | 256 DEF_GM(return new TextBlobLooperGM;) |
| 257 } | 257 } |
| OLD | NEW |