OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
11 #include "SkPath.h" | 11 #include "SkPath.h" |
12 #include "SkRandom.h" | 12 #include "SkRandom.h" |
13 | 13 |
14 int make_bm(SkBitmap* bm, int height) { | 14 int make_bm(SkBitmap* bm, int height) { |
15 static const int kRadius = 22; | 15 constexpr int kRadius = 22; |
16 static const int kMargin = 8; | 16 constexpr int kMargin = 8; |
17 static const SkScalar kStartAngle = 0; | 17 constexpr SkScalar kStartAngle = 0; |
18 static const SkScalar kDAngle = 25; | 18 constexpr SkScalar kDAngle = 25; |
19 static const SkScalar kSweep = 320; | 19 constexpr SkScalar kSweep = 320; |
20 static const SkScalar kThickness = 8; | 20 constexpr SkScalar kThickness = 8; |
21 | 21 |
22 int count = (height / (2 * kRadius + kMargin)); | 22 int count = (height / (2 * kRadius + kMargin)); |
23 height = count * (2 * kRadius + kMargin); | 23 height = count * (2 * kRadius + kMargin); |
24 | 24 |
25 bm->allocN32Pixels(2 * (kRadius + kMargin), height); | 25 bm->allocN32Pixels(2 * (kRadius + kMargin), height); |
26 SkRandom random; | 26 SkRandom random; |
27 | 27 |
28 SkCanvas wholeCanvas(*bm); | 28 SkCanvas wholeCanvas(*bm); |
29 wholeCanvas.clear(0x00000000); | 29 wholeCanvas.clear(0x00000000); |
30 | 30 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 struct { | 97 struct { |
98 SkBitmap fBmp; | 98 SkBitmap fBmp; |
99 int fItemCnt; | 99 int fItemCnt; |
100 } fTallBmps[8]; | 100 } fTallBmps[8]; |
101 typedef skiagm::GM INHERITED; | 101 typedef skiagm::GM INHERITED; |
102 }; | 102 }; |
103 | 103 |
104 ////////////////////////////////////////////////////////////////////////////// | 104 ////////////////////////////////////////////////////////////////////////////// |
105 | 105 |
106 DEF_GM(return new TallStretchedBitmapsGM;) | 106 DEF_GM(return new TallStretchedBitmapsGM;) |
OLD | NEW |