OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "effects/GrPorterDuffXferProcessor.h" | 8 #include "effects/GrPorterDuffXferProcessor.h" |
9 | 9 |
10 #include "GrBlend.h" | 10 #include "GrBlend.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
395 } else { | 395 } else { |
396 fDstBlend = kOne_GrBlendCoeff; | 396 fDstBlend = kOne_GrBlendCoeff; |
397 return GrXferProcessor::kSkipDraw_OptFlag; | 397 return GrXferProcessor::kSkipDraw_OptFlag; |
398 } | 398 } |
399 } | 399 } |
400 | 400 |
401 // if we don't have coverage we can check whether the dst | 401 // if we don't have coverage we can check whether the dst |
402 // has to read at all. If not, we'll disable blending. | 402 // has to read at all. If not, we'll disable blending. |
403 if (!hasCoverage) { | 403 if (!hasCoverage) { |
404 if (dstCoeffIsZero) { | 404 if (dstCoeffIsZero) { |
405 if (kOne_GrBlendCoeff == fSrcBlend) { | 405 if (kOne_GrBlendCoeff == fSrcBlend && |
406 !colorPOI.needsCoverageModulation()) { | |
bsalomon
2015/03/31 16:37:33
I know needCoverageModulation mirrors the extensio
vbuzinov
2015/04/02 13:10:37
Done.
| |
406 // if there is no coverage and coeffs are (1,0) then we | 407 // if there is no coverage and coeffs are (1,0) then we |
407 // won't need to read the dst at all, it gets replaced by src | 408 // won't need to read the dst at all, it gets replaced by src |
408 fDstBlend = kZero_GrBlendCoeff; | 409 fDstBlend = kZero_GrBlendCoeff; |
409 return GrXferProcessor::kNone_Opt; | 410 return GrXferProcessor::kNone_Opt; |
410 } else if (kZero_GrBlendCoeff == fSrcBlend) { | 411 } else if (kZero_GrBlendCoeff == fSrcBlend) { |
411 // if the op is "clear" then we don't need to emit a color | 412 // if the op is "clear" then we don't need to emit a color |
412 // or blend, just write transparent black into the dst. | 413 // or blend, just write transparent black into the dst. |
413 fSrcBlend = kOne_GrBlendCoeff; | 414 fSrcBlend = kOne_GrBlendCoeff; |
414 fDstBlend = kZero_GrBlendCoeff; | 415 fDstBlend = kZero_GrBlendCoeff; |
415 return GrXferProcessor::kIgnoreColor_OptFlag | | 416 return GrXferProcessor::kIgnoreColor_OptFlag | |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
700 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory); | 701 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory); |
701 | 702 |
702 GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random, | 703 GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random, |
703 GrContext*, | 704 GrContext*, |
704 const GrDrawTargetCaps&, | 705 const GrDrawTargetCaps&, |
705 GrTexture*[]) { | 706 GrTexture*[]) { |
706 SkXfermode::Mode mode = SkXfermode::Mode(random->nextULessThan(SkXfermode::k LastCoeffMode)); | 707 SkXfermode::Mode mode = SkXfermode::Mode(random->nextULessThan(SkXfermode::k LastCoeffMode)); |
707 return GrPorterDuffXPFactory::Create(mode); | 708 return GrPorterDuffXPFactory::Create(mode); |
708 } | 709 } |
709 | 710 |
OLD | NEW |