| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 GrXferProcessor* | 299 GrXferProcessor* |
| 300 GrArithmeticXPFactory::onCreateXferProcessor(const GrCaps& caps, | 300 GrArithmeticXPFactory::onCreateXferProcessor(const GrCaps& caps, |
| 301 const GrProcOptInfo& colorPOI, | 301 const GrProcOptInfo& colorPOI, |
| 302 const GrProcOptInfo& coveragePOI, | 302 const GrProcOptInfo& coveragePOI, |
| 303 const DstTexture* dstTexture) const
{ | 303 const DstTexture* dstTexture) const
{ |
| 304 return ArithmeticXP::Create(fK1, fK2, fK3, fK4, fEnforcePMColor, dstTexture, | 304 return ArithmeticXP::Create(fK1, fK2, fK3, fK4, fEnforcePMColor, dstTexture, |
| 305 this->willReadDstColor(caps, colorPOI, coverageP
OI)); | 305 this->willReadDstColor(caps, colorPOI, coverageP
OI)); |
| 306 } | 306 } |
| 307 | 307 |
| 308 | 308 |
| 309 void GrArithmeticXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI, | 309 void GrArithmeticXPFactory::getInvariantBlendedColor(const GrProcOptInfo& /*colo
rPOI*/, |
| 310 const GrProcOptInfo& coveragePOI, | 310 const GrProcOptInfo& /*cove
ragePOI*/, |
| 311 GrXPFactory::InvariantOutput* out
put) const { | 311 InvariantBlendedColor* blen
dedColor) const { |
| 312 output->fWillBlendWithDst = true; | 312 blendedColor->fWillBlendWithDst = true; |
| 313 | 313 |
| 314 // TODO: We could try to optimize this more. For example if we have solid co
verage and fK1 and | 314 // TODO: We could try to optimize this more. For example if fK1 and fK3 are
zero, then we won't |
| 315 // fK3 are zero, then we won't be blending the color with dst at all so we c
an know what the | 315 // be blending the color with dst at all so we can know what the output colo
r is (up to the |
| 316 // output color is (up to the valid color components passed in). | 316 // valid color components passed in). |
| 317 output->fBlendedColorFlags = 0; | 317 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; |
| 318 } | 318 } |
| 319 | 319 |
| 320 GR_DEFINE_XP_FACTORY_TEST(GrArithmeticXPFactory); | 320 GR_DEFINE_XP_FACTORY_TEST(GrArithmeticXPFactory); |
| 321 | 321 |
| 322 GrXPFactory* GrArithmeticXPFactory::TestCreate(SkRandom* random, | 322 GrXPFactory* GrArithmeticXPFactory::TestCreate(SkRandom* random, |
| 323 GrContext*, | 323 GrContext*, |
| 324 const GrCaps&, | 324 const GrCaps&, |
| 325 GrTexture*[]) { | 325 GrTexture*[]) { |
| 326 float k1 = random->nextF(); | 326 float k1 = random->nextF(); |
| 327 float k2 = random->nextF(); | 327 float k2 = random->nextF(); |
| 328 float k3 = random->nextF(); | 328 float k3 = random->nextF(); |
| 329 float k4 = random->nextF(); | 329 float k4 = random->nextF(); |
| 330 bool enforcePMColor = random->nextBool(); | 330 bool enforcePMColor = random->nextBool(); |
| 331 | 331 |
| 332 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); | 332 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); |
| 333 } | 333 } |
| 334 | 334 |
| 335 #endif | 335 #endif |
| OLD | NEW |