jumper, another batch of blend modes

Change-Id: I0c48ec80eee8b7c7e9fb980efa8ed1dad5ad9768
Reviewed-on: https://skia-review.googlesource.com/10924
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-03-31 10:29:40 -04:00 committed by Skia Commit-Bot
parent aaca1e44b1
commit 66b09abdb1
4 changed files with 1467 additions and 288 deletions

View File

@ -57,6 +57,10 @@ static K kConstants = {
M(plus_) \
M(screen) \
M(xor_) \
M(darken) \
M(lighten) \
M(difference) \
M(exclusion) \
M(clamp_0) \
M(clamp_1) \
M(clamp_a) \

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -531,6 +531,7 @@ STAGE(constant_color) {
SI F name##_channel(F s, F d, F sa, F da)
SI F inv(F x) { return 1.0_f - x; }
SI F two(F x) { return x + x; }
BLEND_MODE(clear) { return 0; }
BLEND_MODE(srcatop) { return s*da + d*inv(sa); }
@ -548,6 +549,22 @@ BLEND_MODE(plus_) { return s + d; }
BLEND_MODE(screen) { return s + d - s*d; }
BLEND_MODE(xor_) { return s*inv(da) + d*inv(sa); }
#undef BLEND_MODE
#define BLEND_MODE(name) \
SI F name##_channel(F s, F d, F sa, F da); \
STAGE(name) { \
r = name##_channel(r,dr,a,da); \
g = name##_channel(g,dg,a,da); \
b = name##_channel(b,db,a,da); \
a = mad(da, inv(a), a); \
} \
SI F name##_channel(F s, F d, F sa, F da)
BLEND_MODE(darken) { return s + d - max(s*da, d*sa) ; }
BLEND_MODE(lighten) { return s + d - min(s*da, d*sa) ; }
BLEND_MODE(difference) { return s + d - two(min(s*da, d*sa)); }
BLEND_MODE(exclusion) { return s + d - two(s*d); }
STAGE(clamp_0) {
r = max(r, 0);
g = max(g, 0);