aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-15 12:20:36 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-15 12:20:36 +0000
commite38e53b5327e2618a97fb26a697a477b74c44d3d (patch)
tree32fc5f26d20195b701c8f1010c771d084ba82ceb
parentafbb685123a12886aab028c3b1378d09874a8ee9 (diff)
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
-rw-r--r--src/core/SkXfermode.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index 2cfdcfa4b3..020ea48b37 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -400,9 +400,12 @@ static SkPMColor difference_modeproc(SkPMColor src, SkPMColor dst) {
}
// 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) {