Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: src/effects/SkColorFilters.cpp

Issue 656503002: Move willUseInputColor check to computeInvariantOutput (Closed) Base URL: https://skia.googlesource.com/skia.git@addMultFlag
Patch Set: Rebase2 Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkColorMatrixFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkColorFilters.cpp
diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp
index d96aadfed78053def9766a882d3edd1653767193..4c6474a9c38aa4e57e670361caa9aa9a1adc3739 100644
--- a/src/effects/SkColorFilters.cpp
+++ b/src/effects/SkColorFilters.cpp
@@ -274,17 +274,7 @@ public:
private:
ModeColorFilterEffect(GrColor color, SkXfermode::Mode mode)
: fMode(mode),
- fColor(color) {
-
- SkXfermode::Coeff dstCoeff;
- SkXfermode::Coeff srcCoeff;
- SkAssertResult(SkXfermode::ModeAsCoeff(fMode, &srcCoeff, &dstCoeff));
- // These could be calculated from the blend equation with template trickery..
- if (SkXfermode::kZero_Coeff == dstCoeff &&
- !GrBlendCoeffRefsDst(sk_blend_to_grblend(srcCoeff))) {
- this->setWillNotUseInputColor();
- }
- }
+ fColor(color) {}
virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE {
const ModeColorFilterEffect& s = other.cast<ModeColorFilterEffect>();
@@ -392,7 +382,17 @@ void ModeColorFilterEffect::onComputeInvariantOutput(InvariantOutput* inout) con
MaskedColorExpr(filterColor, kRGBA_GrColorComponentFlags),
MaskedColorExpr(inputColor, inout->validFlags()));
- inout->setToOther(result.getValidComponents(), result.getColor());
+ // Check if we will use the input color
+ SkXfermode::Coeff dstCoeff;
+ SkXfermode::Coeff srcCoeff;
+ SkAssertResult(SkXfermode::ModeAsCoeff(fMode, &srcCoeff, &dstCoeff));
+ InvariantOutput::ReadInput readInput = InvariantOutput::kWill_ReadInput;
+ // These could be calculated from the blend equation with template trickery..
+ if (SkXfermode::kZero_Coeff == dstCoeff &&
+ !GrBlendCoeffRefsDst(sk_blend_to_grblend(srcCoeff))) {
+ readInput = InvariantOutput::kWillNot_ReadInput;
+ }
+ inout->setToOther(result.getValidComponents(), result.getColor(), readInput);
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ModeColorFilterEffect);
« no previous file with comments | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkColorMatrixFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698