OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 #include "SkColorFilter.h" | 9 #include "SkColorFilter.h" |
10 #include "Test.h" | 10 #include "Test.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 // An unknown color with known alpha and red component filtered with Mul
tiply produces an unknown color with known red and alpha. | 96 // An unknown color with known alpha and red component filtered with Mul
tiply produces an unknown color with known red and alpha. |
97 { kR|kA , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode:
:kModulate_Mode, kR|kA, GrColorPackRGBA(50, 0, 0, 64) } | 97 { kR|kA , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode:
:kModulate_Mode, kR|kA, GrColorPackRGBA(50, 0, 0, 64) } |
98 }; | 98 }; |
99 | 99 |
100 GrPaint paint; | 100 GrPaint paint; |
101 for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) { | 101 for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) { |
102 const GetConstantComponentTestCase& test = filterTests[i]; | 102 const GetConstantComponentTestCase& test = filterTests[i]; |
103 SkAutoTUnref<SkColorFilter> cf( | 103 SkAutoTUnref<SkColorFilter> cf( |
104 SkColorFilter::CreateModeFilter(test.filterColor, test.filterMode)); | 104 SkColorFilter::CreateModeFilter(test.filterColor, test.filterMode)); |
105 SkAutoTUnref<const GrFragmentProcessor> fp( cf->asFragmentProcessor(grCo
ntext)); | 105 SkAutoTUnref<const GrFragmentProcessor> fp(cf->asFragmentProcessor(grCon
text, NULL)); |
106 REPORTER_ASSERT(reporter, fp); | 106 REPORTER_ASSERT(reporter, fp); |
107 GrInvariantOutput inout(test.inputColor, | 107 GrInvariantOutput inout(test.inputColor, |
108 static_cast<GrColorComponentFlags>(test.inputCom
ponents), | 108 static_cast<GrColorComponentFlags>(test.inputCom
ponents), |
109 false); | 109 false); |
110 fp->computeInvariantOutput(&inout); | 110 fp->computeInvariantOutput(&inout); |
111 REPORTER_ASSERT(reporter, filterColor(inout.color(), inout.validFlags())
== | 111 REPORTER_ASSERT(reporter, filterColor(inout.color(), inout.validFlags())
== |
112 test.outputColor); | 112 test.outputColor); |
113 REPORTER_ASSERT(reporter, test.outputComponents == inout.validFlags()); | 113 REPORTER_ASSERT(reporter, test.outputComponents == inout.validFlags()); |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 DEF_GPUTEST(GpuColorFilter, reporter, factory) { | 117 DEF_GPUTEST(GpuColorFilter, reporter, factory) { |
118 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { | 118 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { |
119 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G
LContextType>(type); | 119 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G
LContextType>(type); |
120 | 120 |
121 GrContext* grContext = factory->get(glType); | 121 GrContext* grContext = factory->get(glType); |
122 if (nullptr == grContext) { | 122 if (nullptr == grContext) { |
123 continue; | 123 continue; |
124 } | 124 } |
125 | 125 |
126 test_getConstantColorComponents(reporter, grContext); | 126 test_getConstantColorComponents(reporter, grContext); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 #endif | 130 #endif |
OLD | NEW |