add srcover_rgba_8888

Change-Id: Iabdc79183ccd2f9cc513d4bdc530fb078b1627ab
Reviewed-on: https://skia-review.googlesource.com/17930
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-05-25 13:06:57 -04:00 committed by Skia Commit-Bot
parent 9b51d1484a
commit 506262665c
5 changed files with 4444 additions and 3403 deletions

View File

@ -85,6 +85,7 @@ struct SkJumper_Engine;
M(colorburn) M(colordodge) M(darken) M(difference) \
M(exclusion) M(hardlight) M(lighten) M(overlay) M(softlight) \
M(hue) M(saturation) M(color) M(luminosity) \
M(srcover_rgba_8888) \
M(luminance_to_alpha) \
M(matrix_2x3) M(matrix_3x4) M(matrix_4x5) M(matrix_4x3) \
M(matrix_perspective) \

View File

@ -317,12 +317,19 @@ void SkRasterPipelineBlitter::blitH(int x, int y, int w) {
if (!fBlitH) {
SkRasterPipeline p(fAlloc);
p.extend(fColorPipeline);
if (fBlend != SkBlendMode::kSrc) {
this->append_load_d(&p);
this->append_blend(&p);
this->maybe_clamp(&p);
if (fBlend == SkBlendMode::kSrcOver
&& fDst.info().colorType() == kRGBA_8888_SkColorType
&& !fDst.colorSpace()
&& fDitherCtx.rate == 0.0f) {
p.append(SkRasterPipeline::srcover_rgba_8888, &fDstPtr);
} else {
if (fBlend != SkBlendMode::kSrc) {
this->append_load_d(&p);
this->append_blend(&p);
this->maybe_clamp(&p);
}
this->append_store(&p);
}
this->append_store(&p);
fBlitH = p.compile();
}
this->maybe_shade(x,y,w);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -540,6 +540,30 @@ STAGE(luminosity) {
a = a + da - a*da;
}
STAGE(srcover_rgba_8888) {
auto ptr = *(uint32_t**)ctx + x;
U32 dst = load<U32>(ptr, tail);
dr = cast((dst ) & 0xff);
dg = cast((dst >> 8) & 0xff);
db = cast((dst >> 16) & 0xff);
da = cast((dst >> 24) );
// {dr,dg,db,da} are in [0,255]
// { r, g, b, a} are in [0, 1]
r = mad(dr, inv(a), r*255.0f);
g = mad(dg, inv(a), g*255.0f);
b = mad(db, inv(a), b*255.0f);
a = mad(da, inv(a), a*255.0f);
// { r, g, b, a} are now in [0,255]
dst = round(r, 1.0f)
| round(g, 1.0f) << 8
| round(b, 1.0f) << 16
| round(a, 1.0f) << 24;
store(ptr, dst, tail);
}
STAGE(clamp_0) {
r = max(r, 0);
g = max(g, 0);