OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkColorFilter.h" | 8 #include "SkColorFilter.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 if (flags & kB_GrColorComponentFlag) { | 26 if (flags & kB_GrColorComponentFlag) { |
27 mask |= 0xFF << GrColor_SHIFT_B; | 27 mask |= 0xFF << GrColor_SHIFT_B; |
28 } | 28 } |
29 if (flags & kA_GrColorComponentFlag) { | 29 if (flags & kA_GrColorComponentFlag) { |
30 mask |= 0xFF << GrColor_SHIFT_A; | 30 mask |= 0xFF << GrColor_SHIFT_A; |
31 } | 31 } |
32 return color & mask; | 32 return color & mask; |
33 } | 33 } |
34 | 34 |
35 DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GpuColorFilter, reporter, ctxInfo) { | 35 DEF_GPUTEST_FOR_ALL_CONTEXTS(GpuColorFilter, reporter, ctxInfo) { |
36 struct GetConstantComponentTestCase { | 36 struct GetConstantComponentTestCase { |
37 // "Shape drawn with" | 37 // "Shape drawn with" |
38 uint32_t inputComponents; // "rgb of", "red of", "alpha of", ... | 38 uint32_t inputComponents; // "rgb of", "red of", "alpha of", ... |
39 GrColor inputColor; // "[color]" | 39 GrColor inputColor; // "[color]" |
40 | 40 |
41 SkColor filterColor; // "with filter color [color]" | 41 SkColor filterColor; // "with filter color [color]" |
42 SkXfermode::Mode filterMode; // "in mode [mode]" | 42 SkXfermode::Mode filterMode; // "in mode [mode]" |
43 | 43 |
44 // "produces" | 44 // "produces" |
45 uint32_t outputComponents; // "rgb of", "red of", "alpha of", ... | 45 uint32_t outputComponents; // "rgb of", "red of", "alpha of", ... |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 static_cast<GrColorComponentFlags>(test.inputCom
ponents), | 105 static_cast<GrColorComponentFlags>(test.inputCom
ponents), |
106 false); | 106 false); |
107 fp->computeInvariantOutput(&inout); | 107 fp->computeInvariantOutput(&inout); |
108 REPORTER_ASSERT(reporter, filterColor(inout.color(), inout.validFlags())
== | 108 REPORTER_ASSERT(reporter, filterColor(inout.color(), inout.validFlags())
== |
109 test.outputColor); | 109 test.outputColor); |
110 REPORTER_ASSERT(reporter, test.outputComponents == inout.validFlags()); | 110 REPORTER_ASSERT(reporter, test.outputComponents == inout.validFlags()); |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 #endif | 114 #endif |
OLD | NEW |