OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
10 #include "SkDashPathEffect.h" | 10 #include "SkDashPathEffect.h" |
11 #include "SkGradientShader.h" | 11 #include "SkGradientShader.h" |
12 #include "SkPaint.h" | 12 #include "SkPaint.h" |
13 #include "SkPath.h" | 13 #include "SkPath.h" |
14 #include "SkPoint3.h" | 14 #include "SkPoint3.h" |
15 | 15 |
16 static const int kNumColumns = 6; | 16 constexpr int kNumColumns = 6; |
17 static const int kNumRows = 8; | 17 constexpr int kNumRows = 8; |
18 static const int kRadius = 40; // radius of the snowflake | 18 constexpr int kRadius = 40; // radius of the snowflake |
19 static const int kPad = 5; // padding on both sides of the snowflake | 19 constexpr int kPad = 5; // padding on both sides of the snowflake |
20 static const int kNumSpokes = 6; | 20 constexpr int kNumSpokes = 6; |
21 static const SkScalar kStrokeWidth = 5.0f; | 21 constexpr SkScalar kStrokeWidth = 5.0f; |
22 | 22 |
23 static void draw_fins(SkCanvas* canvas, const SkPoint& offset, float angle, cons
t SkPaint& paint) { | 23 static void draw_fins(SkCanvas* canvas, const SkPoint& offset, float angle, cons
t SkPaint& paint) { |
24 SkScalar cos, sin; | 24 SkScalar cos, sin; |
25 | 25 |
26 // first fin | 26 // first fin |
27 sin = SkScalarSinCos(angle + (SK_ScalarPI/4), &cos); | 27 sin = SkScalarSinCos(angle + (SK_ScalarPI/4), &cos); |
28 sin *= kRadius / 2.0f; | 28 sin *= kRadius / 2.0f; |
29 cos *= kRadius / 2.0f; | 29 cos *= kRadius / 2.0f; |
30 | 30 |
31 SkPath p; | 31 SkPath p; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 SkTArray<SkPaint> fPaints; | 219 SkTArray<SkPaint> fPaints; |
220 SkTArray<SkMatrix> fMatrices; | 220 SkTArray<SkMatrix> fMatrices; |
221 | 221 |
222 typedef GM INHERITED; | 222 typedef GM INHERITED; |
223 }; | 223 }; |
224 | 224 |
225 ////////////////////////////////////////////////////////////////////////////// | 225 ////////////////////////////////////////////////////////////////////////////// |
226 | 226 |
227 DEF_GM(return new StrokedLinesGM;) | 227 DEF_GM(return new StrokedLinesGM;) |
228 } | 228 } |
OLD | NEW |