| 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 "effects/GrCustomXfermode.h" | 8 #include "effects/GrCustomXfermode.h" |
| 9 #include "effects/GrCustomXfermodePriv.h" | 9 #include "effects/GrCustomXfermodePriv.h" |
| 10 | 10 |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 f * blend(Sa, Da) + (1-f) * Da | 744 f * blend(Sa, Da) + (1-f) * Da |
| 745 = f * (Sa + Da - Sa * Da) + (1-f) * Da | 745 = f * (Sa + Da - Sa * Da) + (1-f) * Da |
| 746 = f*Sa + f*Da - f*Sa * Da + Da - f*Da | 746 = f*Sa + f*Da - f*Sa * Da + Da - f*Da |
| 747 = f*Sa - f*Sa * Da + Da | 747 = f*Sa - f*Sa * Da + Da |
| 748 = f*Sa + Da - f*Sa * Da | 748 = f*Sa + Da - f*Sa * Da |
| 749 = blend(f*Sa, Da) | 749 = blend(f*Sa, Da) |
| 750 */ | 750 */ |
| 751 | 751 |
| 752 OptFlags flags = kNone_Opt; | 752 OptFlags flags = kNone_Opt; |
| 753 if (colorPOI.allStagesMultiplyInput()) { | 753 if (colorPOI.allStagesMultiplyInput()) { |
| 754 flags = flags | kCanTweakAlphaForCoverage_OptFlag; | 754 flags |= kCanTweakAlphaForCoverage_OptFlag; |
| 755 } | 755 } |
| 756 if (coveragePOI.isSolidWhite()) { | 756 if (coveragePOI.isSolidWhite()) { |
| 757 flags = flags | kIgnoreCoverage_OptFlag; | 757 flags |= kIgnoreCoverage_OptFlag; |
| 758 } | 758 } |
| 759 if (caps.advancedBlendEquationSupport() && !coveragePOI.isFourChannelOutput(
)) { | 759 if (caps.advancedBlendEquationSupport() && !coveragePOI.isFourChannelOutput(
)) { |
| 760 // This blend mode can be implemented in hardware. | 760 // This blend mode can be implemented in hardware. |
| 761 fHWBlendEquation = hw_blend_equation(fMode); | 761 fHWBlendEquation = hw_blend_equation(fMode); |
| 762 } | 762 } |
| 763 return flags; | 763 return flags; |
| 764 } | 764 } |
| 765 | 765 |
| 766 bool CustomXP::onWillNeedXferBarrier(const GrRenderTarget* rt, | 766 bool CustomXP::onWillNeedXferBarrier(const GrRenderTarget* rt, |
| 767 const GrDrawTargetCaps& caps, | 767 const GrDrawTargetCaps& caps, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory); | 818 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory); |
| 819 GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand, | 819 GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand, |
| 820 GrContext*, | 820 GrContext*, |
| 821 const GrDrawTargetCaps&, | 821 const GrDrawTargetCaps&, |
| 822 GrTexture*[]) { | 822 GrTexture*[]) { |
| 823 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas
tSeparableMode); | 823 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas
tSeparableMode); |
| 824 | 824 |
| 825 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode))); | 825 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode))); |
| 826 } | 826 } |
| 827 | 827 |
| OLD | NEW |