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 | 9 |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
11 #include "SkPicture.h" | 11 #include "SkPicture.h" |
12 #include "SkPictureRecorder.h" | 12 #include "SkPictureRecorder.h" |
13 #include "SkShader.h" | 13 #include "SkShader.h" |
14 | 14 |
15 static const SkScalar kPictureSize = SK_Scalar1; | 15 constexpr SkScalar kPictureSize = SK_Scalar1; |
16 static const SkScalar kFillSize = 100; | 16 constexpr SkScalar kFillSize = 100; |
17 static const unsigned kRowSize = 6; | 17 constexpr unsigned kRowSize = 6; |
18 | 18 |
19 static const struct { | 19 constexpr struct { |
20 SkScalar x, y, w, h; | 20 SkScalar x, y, w, h; |
21 SkScalar offsetX, offsetY; | 21 SkScalar offsetX, offsetY; |
22 } tiles[] = { | 22 } tiles[] = { |
23 { 0, 0, 1, 1, 0, 0 }, | 23 { 0, 0, 1, 1, 0, 0 }, |
24 { -0.5f, -0.5f, 1, 1, 0, 0 }, | 24 { -0.5f, -0.5f, 1, 1, 0, 0 }, |
25 { 0.5f, 0.5f, 1, 1, 0, 0 }, | 25 { 0.5f, 0.5f, 1, 1, 0, 0 }, |
26 | 26 |
27 { 0, 0, 1.5f, 1.5f, 0, 0 }, | 27 { 0, 0, 1.5f, 1.5f, 0, 0 }, |
28 { -0.5f, -0.5f, 1.5f, 1.5f, 0, 0 }, | 28 { -0.5f, -0.5f, 1.5f, 1.5f, 0, 0 }, |
29 { 0.5f, 0.5f, 1.5f, 1.5f, 0, 0 }, | 29 { 0.5f, 0.5f, 1.5f, 1.5f, 0, 0 }, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 private: | 150 private: |
151 sk_sp<SkShader> fShaders[SK_ARRAY_COUNT(tiles)]; | 151 sk_sp<SkShader> fShaders[SK_ARRAY_COUNT(tiles)]; |
152 | 152 |
153 typedef GM INHERITED; | 153 typedef GM INHERITED; |
154 }; | 154 }; |
155 | 155 |
156 DEF_GM(return new PictureShaderTileGM;) | 156 DEF_GM(return new PictureShaderTileGM;) |
OLD | NEW |