OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 // This test only works with the GPU backend. | 8 // This test only works with the GPU backend. |
9 | 9 |
10 #include "gm.h" | 10 #include "gm.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 if (!drawContext) { | 50 if (!drawContext) { |
51 skiagm::GM::DrawGpuOnlyMessage(canvas); | 51 skiagm::GM::DrawGpuOnlyMessage(canvas); |
52 return; | 52 return; |
53 } | 53 } |
54 | 54 |
55 GrContext* context = canvas->getGrContext(); | 55 GrContext* context = canvas->getGrContext(); |
56 if (!context) { | 56 if (!context) { |
57 return; | 57 return; |
58 } | 58 } |
59 | 59 |
60 static const GrColor kColors[] = { | 60 constexpr GrColor kColors[] = { |
61 0xFFFFFFFF, | 61 0xFFFFFFFF, |
62 0xFFFF00FF, | 62 0xFFFF00FF, |
63 0x80000000, | 63 0x80000000, |
64 0x00000000, | 64 0x00000000, |
65 }; | 65 }; |
66 | 66 |
67 static const SkColor kPaintColors[] = { | 67 constexpr SkColor kPaintColors[] = { |
68 0xFFFFFFFF, | 68 0xFFFFFFFF, |
69 0xFFFF0000, | 69 0xFFFF0000, |
70 0x80FF0000, | 70 0x80FF0000, |
71 0x00000000, | 71 0x00000000, |
72 }; | 72 }; |
73 | 73 |
74 static const char* kModeStrs[] { | 74 const char* kModeStrs[] { |
75 "kIgnore", | 75 "kIgnore", |
76 "kModulateRGBA", | 76 "kModulateRGBA", |
77 "kModulateA", | 77 "kModulateA", |
78 }; | 78 }; |
79 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kModeStrs) == GrConstColorProcessor::kIn
putModeCnt); | 79 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kModeStrs) == GrConstColorProcessor::kIn
putModeCnt); |
80 | 80 |
81 SkScalar y = kPad; | 81 SkScalar y = kPad; |
82 SkScalar x = kPad; | 82 SkScalar x = kPad; |
83 SkScalar maxW = 0; | 83 SkScalar maxW = 0; |
84 for (size_t paintType = 0; paintType < SK_ARRAY_COUNT(kPaintColors) + 1;
++paintType) { | 84 for (size_t paintType = 0; paintType < SK_ARRAY_COUNT(kPaintColors) + 1;
++paintType) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 } | 169 } |
170 } | 170 } |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
174 private: | 174 private: |
175 // Use this as a way of generating and input FP | 175 // Use this as a way of generating and input FP |
176 sk_sp<SkShader> fShader; | 176 sk_sp<SkShader> fShader; |
177 | 177 |
178 static const SkScalar kPad; | 178 static constexpr SkScalar kPad = 10.f; |
179 static const SkScalar kRectSize; | 179 static constexpr SkScalar kRectSize = 20.f; |
180 static const int kWidth = 820; | 180 static constexpr int kWidth = 820; |
181 static const int kHeight = 500; | 181 static constexpr int kHeight = 500; |
182 | 182 |
183 typedef GM INHERITED; | 183 typedef GM INHERITED; |
184 }; | 184 }; |
185 | 185 |
186 const SkScalar ConstColorProcessor::kPad = 10.f; | |
187 const SkScalar ConstColorProcessor::kRectSize = 20.f; | |
188 | |
189 DEF_GM(return new ConstColorProcessor;) | 186 DEF_GM(return new ConstColorProcessor;) |
190 } | 187 } |
191 | 188 |
192 #endif | 189 #endif |
OLD | NEW |