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" |
11 #include "SkBlurMask.h" | 11 #include "SkBlurMask.h" |
12 #include "SkBlurMaskFilter.h" | 12 #include "SkBlurMaskFilter.h" |
13 #include "SkColorMatrixFilter.h" | 13 #include "SkColorMatrixFilter.h" |
14 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
15 #include "SkGradientShader.h" | 15 #include "SkGradientShader.h" |
16 #include "SkGraphics.h" | 16 #include "SkGraphics.h" |
17 #include "SkLayerDrawLooper.h" | 17 #include "SkLayerDrawLooper.h" |
18 #include "SkRandom.h" | 18 #include "SkRandom.h" |
19 #include "SkTextBlob.h" | 19 #include "SkTextBlob.h" |
20 | 20 |
21 namespace skiagm { | 21 namespace skiagm { |
22 | 22 |
23 static const int kWidth = 1250; | 23 constexpr int kWidth = 1250; |
24 static const int kHeight = 700; | 24 constexpr int kHeight = 700; |
25 | 25 |
26 // Unlike the variant in sk_tool_utils, this version positions the glyphs on a d
iagonal | 26 // Unlike the variant in sk_tool_utils, this version positions the glyphs on a d
iagonal |
27 static void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const
SkPaint& origPaint, | 27 static void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const
SkPaint& origPaint, |
28 SkScalar x, SkScalar y) { | 28 SkScalar x, SkScalar y) { |
29 SkPaint paint(origPaint); | 29 SkPaint paint(origPaint); |
30 SkTDArray<uint16_t> glyphs; | 30 SkTDArray<uint16_t> glyphs; |
31 | 31 |
32 size_t len = strlen(text); | 32 size_t len = strlen(text); |
33 glyphs.append(paint.textToGlyphs(text, len, nullptr)); | 33 glyphs.append(paint.textToGlyphs(text, len, nullptr)); |
34 paint.textToGlyphs(text, len, glyphs.begin()); | 34 paint.textToGlyphs(text, len, glyphs.begin()); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 SkAutoTUnref<const SkTextBlob> fBlob; | 248 SkAutoTUnref<const 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 |