summaryrefslogtreecommitdiffstats
path: root/gfx/skia/skia/src/effects/SkArithmeticModePriv.h
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/skia/skia/src/effects/SkArithmeticModePriv.h')
-rw-r--r--gfx/skia/skia/src/effects/SkArithmeticModePriv.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/gfx/skia/skia/src/effects/SkArithmeticModePriv.h b/gfx/skia/skia/src/effects/SkArithmeticModePriv.h
new file mode 100644
index 000000000..e619274d2
--- /dev/null
+++ b/gfx/skia/skia/src/effects/SkArithmeticModePriv.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkArithmeticModePriv_DEFINED
+#define SkArithmeticModePriv_DEFINED
+
+#include "SkArithmeticMode.h"
+
+struct SkArithmeticParams {
+ float fK[4];
+ bool fEnforcePMColor;
+};
+
+#ifndef SK_SUPPORT_LEGACY_ARITHMETICMODE
+
+class SK_API SkArithmeticMode {
+public:
+ /**
+ * result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4]
+ *
+ * k1=k2=k3=0, k4=1.0 results in returning opaque white
+ * k1=k3=k4=0, k2=1.0 results in returning the src
+ * k1=k2=k4=0, k3=1.0 results in returning the dst
+ */
+ static sk_sp<SkXfermode> Make(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4,
+ bool enforcePMColor = true);
+#ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR
+ static SkXfermode* Create(SkScalar k1, SkScalar k2,
+ SkScalar k3, SkScalar k4,
+ bool enforcePMColor = true) {
+ return Make(k1, k2, k3, k4, enforcePMColor).release();
+ }
+#endif
+
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP();
+
+private:
+ SkArithmeticMode(); // can't be instantiated
+};
+
+#endif
+
+#endif