eliminate srcover_bgra_8888

It's the same as swap_rb -> srcover_rgba_8888.

Change-Id: I1849ecce6efd317a37c9640cc283b812cb23cd6d
Reviewed-on: https://skia-review.googlesource.com/c/163172
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
Mike Klein 2018-10-17 17:15:07 -04:00 committed by Skia Commit-Bot
parent b1df5e5b32
commit dd9bfe9a32
3 changed files with 5 additions and 41 deletions

View File

@ -65,7 +65,7 @@
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(srcover_bgra_8888) \
M(srcover_rgba_8888) \
M(matrix_translate) M(matrix_scale_translate) \
M(matrix_2x3) M(matrix_3x3) M(matrix_3x4) M(matrix_4x5) M(matrix_4x3) \
M(matrix_perspective) \

View File

@ -297,10 +297,10 @@ void SkRasterPipelineBlitter::blitRect(int x, int y, int w, int h) {
&& !fDst.colorSpace()
&& fDst.info().alphaType() != kUnpremul_SkAlphaType
&& fDitherRate == 0.0f) {
auto stage = fDst.info().colorType() == kRGBA_8888_SkColorType
? SkRasterPipeline::srcover_rgba_8888
: SkRasterPipeline::srcover_bgra_8888;
p.append(stage, &fDstPtr);
if (fDst.info().colorType() == kBGRA_8888_SkColorType) {
p.append(SkRasterPipeline::swap_rb);
}
p.append(SkRasterPipeline::srcover_rgba_8888, &fDstPtr);
} else {
if (fBlend != SkBlendMode::kSrc) {
this->append_load_dst(&p);

View File

@ -1223,31 +1223,6 @@ STAGE(srcover_rgba_8888, const SkJumper_MemoryCtx* ctx) {
store(ptr, dst, tail);
}
STAGE(srcover_bgra_8888, const SkJumper_MemoryCtx* ctx) {
auto ptr = ptr_at_xy<uint32_t>(ctx, dx,dy);
U32 dst = load<U32>(ptr, tail);
db = cast((dst ) & 0xff);
dg = cast((dst >> 8) & 0xff);
dr = cast((dst >> 16) & 0xff);
da = cast((dst >> 24) );
// {dr,dg,db,da} are in [0,255]
// { r, g, b, a} are in [0, 1] (but may be out of gamut)
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] (but may be out of gamut)
// to_unorm() clamps back to gamut. Scaling by 1 since we're already 255-biased.
dst = to_unorm(b, 1, 255)
| to_unorm(g, 1, 255) << 8
| to_unorm(r, 1, 255) << 16
| to_unorm(a, 1, 255) << 24;
store(ptr, dst, tail);
}
STAGE(clamp_0, Ctx::None) {
r = max(r, 0);
g = max(g, 0);
@ -3222,17 +3197,6 @@ STAGE_PP(srcover_rgba_8888, const SkJumper_MemoryCtx* ctx) {
a = a + div255( da*inv(a) );
store_8888_(ptr, tail, r,g,b,a);
}
STAGE_PP(srcover_bgra_8888, const SkJumper_MemoryCtx* ctx) {
auto ptr = ptr_at_xy<uint32_t>(ctx, dx,dy);
load_8888_(ptr, tail, &db,&dg,&dr,&da);
r = r + div255( dr*inv(a) );
g = g + div255( dg*inv(a) );
b = b + div255( db*inv(a) );
a = a + div255( da*inv(a) );
store_8888_(ptr, tail, b,g,r,a);
}
// Now we'll add null stand-ins for stages we haven't implemented in lowp.
// If a pipeline uses these stages, it'll boot it out of lowp into highp.