OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkArithmeticMode_gpu.h" | 8 #include "SkArithmeticMode_gpu.h" |
9 | 9 |
10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 fEnforcePMColor == fp.fEnforcePMColor; | 132 fEnforcePMColor == fp.fEnforcePMColor; |
133 } | 133 } |
134 | 134 |
135 void GrArithmeticFP::onComputeInvariantOutput(GrInvariantOutput* inout) const { | 135 void GrArithmeticFP::onComputeInvariantOutput(GrInvariantOutput* inout) const { |
136 // TODO: optimize this | 136 // TODO: optimize this |
137 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput); | 137 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput); |
138 } | 138 } |
139 | 139 |
140 /////////////////////////////////////////////////////////////////////////////// | 140 /////////////////////////////////////////////////////////////////////////////// |
141 | 141 |
142 GrFragmentProcessor* GrArithmeticFP::TestCreate(SkRandom* rand, | 142 GrFragmentProcessor* GrArithmeticFP::TestCreate(GrProcessorTestData* d) { |
143 GrContext*, | 143 float k1 = d->fRandom->nextF(); |
144 const GrCaps&, | 144 float k2 = d->fRandom->nextF(); |
145 GrTexture* textures[]) { | 145 float k3 = d->fRandom->nextF(); |
146 float k1 = rand->nextF(); | 146 float k4 = d->fRandom->nextF(); |
147 float k2 = rand->nextF(); | 147 bool enforcePMColor = d->fRandom->nextBool(); |
148 float k3 = rand->nextF(); | |
149 float k4 = rand->nextF(); | |
150 bool enforcePMColor = rand->nextBool(); | |
151 | 148 |
152 GrShaderDataManager shaderDataManager; | 149 return SkNEW_ARGS(GrArithmeticFP, (d->fShaderDataManager, k1, k2, k3, k4, en
forcePMColor, |
153 return SkNEW_ARGS(GrArithmeticFP, (&shaderDataManager, k1, k2, k3, k4, enfor
cePMColor, | 150 d->fTextures[0])); |
154 textures[0])); | |
155 } | 151 } |
156 | 152 |
157 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrArithmeticFP); | 153 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrArithmeticFP); |
158 | 154 |
159 /////////////////////////////////////////////////////////////////////////////// | 155 /////////////////////////////////////////////////////////////////////////////// |
160 // Xfer Processor | 156 // Xfer Processor |
161 /////////////////////////////////////////////////////////////////////////////// | 157 /////////////////////////////////////////////////////////////////////////////// |
162 | 158 |
163 class ArithmeticXP : public GrXferProcessor { | 159 class ArithmeticXP : public GrXferProcessor { |
164 public: | 160 public: |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 blendedColor->fWillBlendWithDst = true; | 294 blendedColor->fWillBlendWithDst = true; |
299 | 295 |
300 // TODO: We could try to optimize this more. For example if fK1 and fK3 are
zero, then we won't | 296 // TODO: We could try to optimize this more. For example if fK1 and fK3 are
zero, then we won't |
301 // be blending the color with dst at all so we can know what the output colo
r is (up to the | 297 // be blending the color with dst at all so we can know what the output colo
r is (up to the |
302 // valid color components passed in). | 298 // valid color components passed in). |
303 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; | 299 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; |
304 } | 300 } |
305 | 301 |
306 GR_DEFINE_XP_FACTORY_TEST(GrArithmeticXPFactory); | 302 GR_DEFINE_XP_FACTORY_TEST(GrArithmeticXPFactory); |
307 | 303 |
308 GrXPFactory* GrArithmeticXPFactory::TestCreate(SkRandom* random, | 304 GrXPFactory* GrArithmeticXPFactory::TestCreate(GrProcessorTestData* d) { |
309 GrContext*, | 305 float k1 = d->fRandom->nextF(); |
310 const GrCaps&, | 306 float k2 = d->fRandom->nextF(); |
311 GrTexture*[]) { | 307 float k3 = d->fRandom->nextF(); |
312 float k1 = random->nextF(); | 308 float k4 = d->fRandom->nextF(); |
313 float k2 = random->nextF(); | 309 bool enforcePMColor = d->fRandom->nextBool(); |
314 float k3 = random->nextF(); | |
315 float k4 = random->nextF(); | |
316 bool enforcePMColor = random->nextBool(); | |
317 | 310 |
318 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); | 311 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); |
319 } | 312 } |
320 | 313 |
321 #endif | 314 #endif |
OLD | NEW |