ColorBurn/ColorDodge stage tweaks

Minor speedup.

Before:

  10212.01 ?	blendmode_rect_ColorBurn	8888
   9216.78 ?	blendmode_rect_ColorDodge	8888

After:

   9635.44 ?	blendmode_rect_ColorBurn	8888
   8820.22 ?	blendmode_rect_ColorDodge	8888

Change-Id: I9e8a9aa21e2370de3174c31821fb0676260d2643
Reviewed-on: https://skia-review.googlesource.com/37620
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This commit is contained in:
Florin Malita 2017-08-23 12:08:37 -04:00 committed by Skia Commit-Bot
parent 3cf781d0e0
commit 59a62ed946
3 changed files with 8387 additions and 8380 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -351,14 +351,14 @@ BLEND_MODE(difference) { return s + d - two(min(s*da, d*sa)); }
BLEND_MODE(exclusion) { return s + d - two(s*d); }
BLEND_MODE(colorburn) {
return if_then_else(d == da, d + s*inv(da),
if_then_else(s == 0, s + d*inv(sa),
sa*(da - min(da, (da-d)*sa/s)) + s*inv(da) + d*inv(sa)));
return if_then_else(d == da, d + s*inv(da),
if_then_else(s == 0, /* s + */ d*inv(sa),
sa*(da - min(da, (da-d)*sa*rcp(s))) + s*inv(da) + d*inv(sa)));
}
BLEND_MODE(colordodge) {
return if_then_else(d == 0, d + s*inv(da),
if_then_else(s == sa, s + d*inv(sa),
sa*min(da, (d*sa)/(sa - s)) + s*inv(da) + d*inv(sa)));
return if_then_else(d == 0, /* d + */ s*inv(da),
if_then_else(s == sa, s + d*inv(sa),
sa*min(da, (d*sa)*rcp(sa - s)) + s*inv(da) + d*inv(sa)));
}
BLEND_MODE(hardlight) {
return s*inv(da) + d*inv(sa)