Index: src/effects/SkColorMatrixFilter.cpp |
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp |
index 82bd45b73ddd759bb0d19ec1bc56f9f4518a6bfa..32cb3d91616be67151779375836790b75899ad68 100644 |
--- a/src/effects/SkColorMatrixFilter.cpp |
+++ b/src/effects/SkColorMatrixFilter.cpp |
@@ -17,6 +17,13 @@ static SkScalar byte_to_scale(U8CPU byte) { |
} |
sk_sp<SkColorFilter> SkColorMatrixFilter::MakeLightingFilter(SkColor mul, SkColor add) { |
+ const SkColor opaqueAlphaMask = SK_ColorBLACK; |
+ // omit the alpha and compare only the RGB values |
+ if (0 == (add & ~opaqueAlphaMask)) { |
+ return SkColorFilter::MakeModeFilter(mul | opaqueAlphaMask, |
+ SkXfermode::Mode::kModulate_Mode); |
+ } |
+ |
SkColorMatrix matrix; |
matrix.setScale(byte_to_scale(SkColorGetR(mul)), |
byte_to_scale(SkColorGetG(mul)), |