| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // A color with unknown alpha filtered with DstOver produces an unknown
color. | 92 // A color with unknown alpha filtered with DstOver produces an unknown
color. |
| 93 { kRGB , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode::
kDstOver_Mode, 0 , gr_black}, | 93 { kRGB , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode::
kDstOver_Mode, 0 , gr_black}, |
| 94 | 94 |
| 95 // An unknown color with known alpha and red component filtered with Mul
tiply produces an unknown color with known red and alpha. | 95 // An unknown color with known alpha and red component filtered with Mul
tiply produces an unknown color with known red and alpha. |
| 96 { kR|kA , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode:
:kModulate_Mode, kR|kA, GrColorPackRGBA(50, 0, 0, 64) } | 96 { kR|kA , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode:
:kModulate_Mode, kR|kA, GrColorPackRGBA(50, 0, 0, 64) } |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 GrPaint paint; | 99 GrPaint paint; |
| 100 for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) { | 100 for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) { |
| 101 const GetConstantComponentTestCase& test = filterTests[i]; | 101 const GetConstantComponentTestCase& test = filterTests[i]; |
| 102 SkAutoTUnref<SkColorFilter> cf( | 102 auto cf(SkColorFilter::MakeModeFilter(test.filterColor, test.filterMode)
); |
| 103 SkColorFilter::CreateModeFilter(test.filterColor, test.filterMode)); | |
| 104 SkAutoTUnref<const GrFragmentProcessor> fp( cf->asFragmentProcessor(cont
ext)); | 103 SkAutoTUnref<const GrFragmentProcessor> fp( cf->asFragmentProcessor(cont
ext)); |
| 105 REPORTER_ASSERT(reporter, fp); | 104 REPORTER_ASSERT(reporter, fp); |
| 106 GrInvariantOutput inout(test.inputColor, | 105 GrInvariantOutput inout(test.inputColor, |
| 107 static_cast<GrColorComponentFlags>(test.inputCom
ponents), | 106 static_cast<GrColorComponentFlags>(test.inputCom
ponents), |
| 108 false); | 107 false); |
| 109 fp->computeInvariantOutput(&inout); | 108 fp->computeInvariantOutput(&inout); |
| 110 REPORTER_ASSERT(reporter, filterColor(inout.color(), inout.validFlags())
== | 109 REPORTER_ASSERT(reporter, filterColor(inout.color(), inout.validFlags())
== |
| 111 test.outputColor); | 110 test.outputColor); |
| 112 REPORTER_ASSERT(reporter, test.outputComponents == inout.validFlags()); | 111 REPORTER_ASSERT(reporter, test.outputComponents == inout.validFlags()); |
| 113 } | 112 } |
| 114 } | 113 } |
| 115 | 114 |
| 116 #endif | 115 #endif |
| OLD | NEW |