Lowp darken stage

Change-Id: I4bf618ad8728541fcef3fc1c6aa5b3ca106d50dc
Reviewed-on: https://skia-review.googlesource.com/33583
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Florin Malita 2017-08-11 15:44:53 -04:00 committed by Skia Commit-Bot
parent 6ad3ffeed1
commit 0bf0bc65e2
4 changed files with 892 additions and 228 deletions

View File

@ -98,7 +98,8 @@ using StartPipelineFn = void(size_t,size_t,size_t,size_t, void**,K*);
M(modulate) \
M(multiply) \
M(screen) \
M(xor_)
M(xor_) \
M(darken)
extern "C" {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -140,6 +140,11 @@ SI V swap_rb(V v) {
#endif
}
SI V max(V a, V b) {
auto gt = a.u8x4 > b.u8x4;
return (a.u8x4 & gt) | (b.u8x4 &~gt);
}
struct Params {
size_t x,y,tail;
};
@ -401,3 +406,9 @@ STAGE(modulate) { src = src*dst; }
STAGE(multiply) { src = src*inv(alpha(dst)) + dst*inv(alpha(src)) + src*dst; }
STAGE(screen) { src = src + inv(src)*dst; }
STAGE(xor_) { src = src*inv(alpha(dst)) + dst*inv(alpha(src)); }
STAGE(darken) {
V rgb = src + (dst - max(src*alpha(dst), dst*alpha(src)));
V a = src + (dst - dst*alpha(src));
src = (rgb.u32 & 0x00ffffff) | (a.u32 & 0xff000000);
}