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 "SkColorCubeFilter.h" | 9 #include "SkColorCubeFilter.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
11 #include "SkGradientShader.h" | 11 #include "SkGradientShader.h" |
12 #include "SkTemplates.h" | 12 #include "SkTemplates.h" |
13 | 13 |
14 namespace skiagm { | 14 namespace skiagm { |
15 | 15 |
16 static sk_sp<SkShader> MakeLinear() { | 16 static sk_sp<SkShader> MakeLinear() { |
17 static const SkPoint pts[2] = { | 17 constexpr SkPoint pts[2] = { |
18 { 0, 0 }, | 18 { 0, 0 }, |
19 { SkIntToScalar(80), SkIntToScalar(80) } | 19 { SkIntToScalar(80), SkIntToScalar(80) } |
20 }; | 20 }; |
21 static const SkColor colors[] = { SK_ColorYELLOW, SK_ColorBLUE }; | 21 constexpr SkColor colors[] = { SK_ColorYELLOW, SK_ColorBLUE }; |
22 return SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkShader::kRepe
at_TileMode, 0, | 22 return SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkShader::kRepe
at_TileMode, 0, |
23 &SkMatrix::I()); | 23 &SkMatrix::I()); |
24 } | 24 } |
25 | 25 |
26 class ColorCubeGM : public GM { | 26 class ColorCubeGM : public GM { |
27 public: | 27 public: |
28 ColorCubeGM() : fInitialized(false) { | 28 ColorCubeGM() : fInitialized(false) { |
29 this->setBGColor(0xFF000000); | 29 this->setBGColor(0xFF000000); |
30 } | 30 } |
31 | 31 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 sk_sp<SkData> f3DLut32; | 115 sk_sp<SkData> f3DLut32; |
116 sk_sp<SkData> f3DLut64; | 116 sk_sp<SkData> f3DLut64; |
117 }; | 117 }; |
118 | 118 |
119 ////////////////////////////////////////////////////////////////////////////// | 119 ////////////////////////////////////////////////////////////////////////////// |
120 | 120 |
121 static GM* MyFactory(void*) { return new ColorCubeGM; } | 121 static GM* MyFactory(void*) { return new ColorCubeGM; } |
122 static GMRegistry reg(MyFactory); | 122 static GMRegistry reg(MyFactory); |
123 | 123 |
124 } | 124 } |
OLD | NEW |