ARM Skia NEON patches - 07 - Equation simplification
Misc: simplify the equation of the exclusion Xfermode
The equation can be dramatically simplified. The results with gm are
the same except that the code is faster.
BUG=
R=djsollen@google.com, reed@google.com, bsalomon@google.com, cabanier@adobe.com
Author: kevin.petit.arm@gmail.com
Review URL: https://chromiumcodereview.appspot.com/18112016
git-svn-id: http://skia.googlecode.com/svn/trunk@10069 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index 2cfdcfa..020ea48 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -400,9 +400,12 @@
}
// kExclusion_Mode
-static inline int exclusion_byte(int sc, int dc, int sa, int da) {
+static inline int exclusion_byte(int sc, int dc, int, int) {
// this equations is wacky, wait for SVG to confirm it
- int r = sc * da + dc * sa - 2 * sc * dc + sc * (255 - da) + dc * (255 - sa);
+ //int r = sc * da + dc * sa - 2 * sc * dc + sc * (255 - da) + dc * (255 - sa);
+
+ // The above equation can be simplified as follows
+ int r = 255*(sc + dc) - 2 * sc * dc;
return clamp_div255round(r);
}
static SkPMColor exclusion_modeproc(SkPMColor src, SkPMColor dst) {