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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 { kRGB , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode::
kDstOver_Mode, 0 , gr_black}, | 92 { kRGB , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode::
kDstOver_Mode, 0 , gr_black}, |
93 | 93 |
94 // An unknown color with known alpha and red component filtered with Mul
tiply produces an unknown color with known red and alpha. | 94 // An unknown color with known alpha and red component filtered with Mul
tiply produces an unknown color with known red and alpha. |
95 { kR|kA , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode:
:kModulate_Mode, kR|kA, GrColorPackRGBA(50, 0, 0, 64) } | 95 { kR|kA , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode:
:kModulate_Mode, kR|kA, GrColorPackRGBA(50, 0, 0, 64) } |
96 }; | 96 }; |
97 | 97 |
98 GrPaint paint; | 98 GrPaint paint; |
99 for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) { | 99 for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) { |
100 const GetConstantComponentTestCase& test = filterTests[i]; | 100 const GetConstantComponentTestCase& test = filterTests[i]; |
101 auto cf(SkColorFilter::MakeModeFilter(test.filterColor, test.filterMode)
); | 101 auto cf(SkColorFilter::MakeModeFilter(test.filterColor, test.filterMode)
); |
102 SkAutoTUnref<const GrFragmentProcessor> fp( cf->asFragmentProcessor(ctxI
nfo.grContext())); | 102 sk_sp<GrFragmentProcessor> fp(cf->asFragmentProcessor(ctxInfo.grContext(
))); |
103 REPORTER_ASSERT(reporter, fp); | 103 REPORTER_ASSERT(reporter, fp); |
104 GrInvariantOutput inout(test.inputColor, | 104 GrInvariantOutput inout(test.inputColor, |
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 |