OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
10 | 10 |
11 #include "gm.h" | 11 #include "gm.h" |
12 | 12 |
13 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
14 | 14 |
15 #include "GrContext.h" | 15 #include "GrContext.h" |
16 #include "GrTest.h" | 16 #include "GrTest.h" |
17 #include "effects/GrConstColorProcessor.h" | 17 #include "effects/GrConstColorProcessor.h" |
18 #include "SkGr.h" | 18 #include "SkGr.h" |
19 #include "SkGradientShader.h" | 19 #include "SkGradientShader.h" |
20 | 20 |
21 namespace skiagm { | 21 namespace skiagm { |
22 /** | 22 /** |
23 * This GM directly exercises GrConstColorProcessor. | 23 * This GM directly exercises GrConstColorProcessor. |
24 */ | 24 */ |
25 class ConstColorProcessor : public GM { | 25 class ConstColorProcessor : public GM { |
26 public: | 26 public: |
27 ConstColorProcessor() { | 27 ConstColorProcessor() { |
28 this->setBGColor(0xFFDDDDDD); | 28 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); |
29 } | 29 } |
30 | 30 |
31 protected: | 31 protected: |
32 SkString onShortName() override { | 32 SkString onShortName() override { |
33 return SkString("const_color_processor"); | 33 return SkString("const_color_processor"); |
34 } | 34 } |
35 | 35 |
36 SkISize onISize() override { | 36 SkISize onISize() override { |
37 return SkISize::Make(kWidth, kHeight); | 37 return SkISize::Make(kWidth, kHeight); |
38 } | 38 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 pipelineBuilder.addColorProcessor(fp); | 117 pipelineBuilder.addColorProcessor(fp); |
118 | 118 |
119 tt.target()->drawSimpleRect(&pipelineBuilder, | 119 tt.target()->drawSimpleRect(&pipelineBuilder, |
120 grPaint.getColor(), | 120 grPaint.getColor(), |
121 viewMatrix, | 121 viewMatrix, |
122 renderRect); | 122 renderRect); |
123 | 123 |
124 // Draw labels for the input to the processor and the proces
sor to the right of | 124 // Draw labels for the input to the processor and the proces
sor to the right of |
125 // the test rect. The input label appears above the processo
r label. | 125 // the test rect. The input label appears above the processo
r label. |
126 SkPaint labelPaint; | 126 SkPaint labelPaint; |
| 127 sk_tool_utils::set_portable_typeface_always(&labelPaint); |
127 labelPaint.setAntiAlias(true); | 128 labelPaint.setAntiAlias(true); |
128 labelPaint.setTextSize(10.f); | 129 labelPaint.setTextSize(10.f); |
129 SkString inputLabel; | 130 SkString inputLabel; |
130 inputLabel.set("Input: "); | 131 inputLabel.set("Input: "); |
131 if (paintType >= SK_ARRAY_COUNT(kPaintColors)) { | 132 if (paintType >= SK_ARRAY_COUNT(kPaintColors)) { |
132 inputLabel.append("gradient"); | 133 inputLabel.append("gradient"); |
133 } else { | 134 } else { |
134 inputLabel.appendf("0x%08x", kPaintColors[paintType]); | 135 inputLabel.appendf("0x%08x", kPaintColors[paintType]); |
135 } | 136 } |
136 SkString procLabel; | 137 SkString procLabel; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 typedef GM INHERITED; | 190 typedef GM INHERITED; |
190 }; | 191 }; |
191 | 192 |
192 const SkScalar ConstColorProcessor::kPad = 10.f; | 193 const SkScalar ConstColorProcessor::kPad = 10.f; |
193 const SkScalar ConstColorProcessor::kRectSize = 20.f; | 194 const SkScalar ConstColorProcessor::kRectSize = 20.f; |
194 | 195 |
195 DEF_GM( return SkNEW(ConstColorProcessor); ) | 196 DEF_GM( return SkNEW(ConstColorProcessor); ) |
196 } | 197 } |
197 | 198 |
198 #endif | 199 #endif |
OLD | NEW |