| 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 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
| 10 | 10 |
| (...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 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 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(test.filt
erColor, test.filterMode)); | 101 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(test.filt
erColor, test.filterMode)); |
| 102 SkAutoTUnref<GrFragmentProcessor> effect(cf->asFragmentProcessor(grConte
xt)); | 102 SkTDArray<GrFragmentProcessor*> array; |
| 103 bool hasFrag = cf->asFragmentProcessors(grContext, &array); |
| 104 REPORTER_ASSERT(reporter, hasFrag); |
| 105 REPORTER_ASSERT(reporter, 1 == array.count()); |
| 103 GrInvariantOutput inout(test.inputColor, | 106 GrInvariantOutput inout(test.inputColor, |
| 104 static_cast<GrColorComponentFlags>(test.inputCom
ponents), | 107 static_cast<GrColorComponentFlags>(test.inputCom
ponents), |
| 105 false); | 108 false); |
| 106 effect->computeInvariantOutput(&inout); | 109 array[0]->computeInvariantOutput(&inout); |
| 107 | 110 |
| 108 REPORTER_ASSERT(reporter, filterColor(inout.color(), inout.validFlags())
== test.outputColor); | 111 REPORTER_ASSERT(reporter, filterColor(inout.color(), inout.validFlags())
== test.outputColor); |
| 109 REPORTER_ASSERT(reporter, test.outputComponents == inout.validFlags()); | 112 REPORTER_ASSERT(reporter, test.outputComponents == inout.validFlags()); |
| 113 array[0]->unref(); |
| 110 } | 114 } |
| 111 } | 115 } |
| 112 | 116 |
| 113 DEF_GPUTEST(GpuColorFilter, reporter, factory) { | 117 DEF_GPUTEST(GpuColorFilter, reporter, factory) { |
| 114 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { | 118 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { |
| 115 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G
LContextType>(type); | 119 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G
LContextType>(type); |
| 116 | 120 |
| 117 GrContext* grContext = factory->get(glType); | 121 GrContext* grContext = factory->get(glType); |
| 118 if (NULL == grContext) { | 122 if (NULL == grContext) { |
| 119 continue; | 123 continue; |
| 120 } | 124 } |
| 121 | 125 |
| 122 test_getConstantColorComponents(reporter, grContext); | 126 test_getConstantColorComponents(reporter, grContext); |
| 123 } | 127 } |
| 124 } | 128 } |
| 125 | 129 |
| 126 #endif | 130 #endif |
| OLD | NEW |