Index: src/effects/SkArithmeticMode.cpp |
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp |
index 9eb7dd2198d26f06777b34eeb4585dad473b9398..33783a52f87bd35bc5a163b4d6e8c62360b332db 100644 |
--- a/src/effects/SkArithmeticMode.cpp |
+++ b/src/effects/SkArithmeticMode.cpp |
@@ -21,8 +21,16 @@ static const bool gUseUnpremul = false; |
class SkArithmeticMode_scalar : public SkXfermode { |
public: |
- static SkArithmeticMode_scalar* Create(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, |
- bool enforcePMColor) { |
+ static SkXfermode* Create(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, |
+ bool enforcePMColor) { |
+ if (SkScalarNearlyZero(k1) && SkScalarNearlyEqual(k2, SK_Scalar1) && |
+ SkScalarNearlyZero(k3) && SkScalarNearlyZero(k4)) { |
+ return SkXfermode::Create(SkXfermode::kSrc_Mode); |
+ } else if (SkScalarNearlyZero(k1) && SkScalarNearlyZero(k2) && |
+ SkScalarNearlyEqual(k3, SK_Scalar1) && SkScalarNearlyZero(k4)) { |
+ return SkXfermode::Create(SkXfermode::kDst_Mode); |
+ } |
+ |
return new SkArithmeticMode_scalar(k1, k2, k3, k4, enforcePMColor); |
} |