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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 | 748 |
749 | 749 |
750 f * blend(Sa, Da) + (1-f) * Da | 750 f * blend(Sa, Da) + (1-f) * Da |
751 = f * (Sa + Da - Sa * Da) + (1-f) * Da | 751 = f * (Sa + Da - Sa * Da) + (1-f) * Da |
752 = f*Sa + f*Da - f*Sa * Da + Da - f*Da | 752 = f*Sa + f*Da - f*Sa * Da + Da - f*Da |
753 = f*Sa - f*Sa * Da + Da | 753 = f*Sa - f*Sa * Da + Da |
754 = f*Sa + Da - f*Sa * Da | 754 = f*Sa + Da - f*Sa * Da |
755 = blend(f*Sa, Da) | 755 = blend(f*Sa, Da) |
756 */ | 756 */ |
757 | 757 |
758 OptFlags flags = kNone_Opt; | 758 OptFlags flags = kNone_OptFlags; |
759 if (colorPOI.allStagesMultiplyInput()) { | 759 if (colorPOI.allStagesMultiplyInput()) { |
760 flags |= kCanTweakAlphaForCoverage_OptFlag; | 760 flags |= kCanTweakAlphaForCoverage_OptFlag; |
761 } | 761 } |
762 if (this->hasHWBlendEquation() && coveragePOI.isSolidWhite()) { | 762 if (this->hasHWBlendEquation() && coveragePOI.isSolidWhite()) { |
763 flags |= kIgnoreCoverage_OptFlag; | 763 flags |= kIgnoreCoverage_OptFlag; |
764 } | 764 } |
765 return flags; | 765 return flags; |
766 } | 766 } |
767 | 767 |
768 bool CustomXP::onWillNeedXferBarrier(const GrRenderTarget* rt, | 768 bool CustomXP::onWillNeedXferBarrier(const GrRenderTarget* rt, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory); | 819 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory); |
820 GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand, | 820 GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand, |
821 GrContext*, | 821 GrContext*, |
822 const GrCaps&, | 822 const GrCaps&, |
823 GrTexture*[]) { | 823 GrTexture*[]) { |
824 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas
tSeparableMode); | 824 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas
tSeparableMode); |
825 | 825 |
826 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode))); | 826 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode))); |
827 } | 827 } |
828 | 828 |
OLD | NEW |