add srcover_bgra_8888
Chrome generally uses BGRA buffers, so srcover_rgba_8888 isn't really doing them any good. Probably a good idea to cover both kN32 options any time we specialize like this? There's one small diff, so I've lazily guarded this by SK_LEGACY_LOWP_STAGES, which I want to rebaseline today anyway. Change-Id: Ice672aa01a3fc83be0798580d6730a54df075478 Reviewed-on: https://skia-review.googlesource.com/63301 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
parent
b2fd61a058
commit
0cb158969c
@ -64,7 +64,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(srcover_rgba_8888) M(srcover_bgra_8888) \
|
||||
M(luminance_to_alpha) \
|
||||
M(matrix_translate) M(matrix_scale_translate) \
|
||||
M(matrix_2x3) M(matrix_3x4) M(matrix_4x5) M(matrix_4x3) \
|
||||
|
@ -305,6 +305,7 @@ void SkRasterPipelineBlitter::blitRect(int x, int y, int w, int h) {
|
||||
if (!fBlitRect) {
|
||||
SkRasterPipeline p(fAlloc);
|
||||
p.extend(fColorPipeline);
|
||||
#if defined(SK_LEGACY_LOWP_STAGES)
|
||||
if (fBlend == SkBlendMode::kSrcOver
|
||||
&& fDst.info().colorType() == kRGBA_8888_SkColorType
|
||||
&& !fDst.colorSpace()
|
||||
@ -312,6 +313,19 @@ void SkRasterPipelineBlitter::blitRect(int x, int y, int w, int h) {
|
||||
&& fDitherRate == 0.0f) {
|
||||
p.clamp_if_unclamped(kPremul_SkAlphaType);
|
||||
p.append(SkRasterPipeline::srcover_rgba_8888, &fDstPtr);
|
||||
#else
|
||||
if (fBlend == SkBlendMode::kSrcOver
|
||||
&& (fDst.info().colorType() == kRGBA_8888_SkColorType ||
|
||||
fDst.info().colorType() == kBGRA_8888_SkColorType)
|
||||
&& !fDst.colorSpace()
|
||||
&& fDst.info().alphaType() != kUnpremul_SkAlphaType
|
||||
&& fDitherRate == 0.0f) {
|
||||
p.clamp_if_unclamped(kPremul_SkAlphaType);
|
||||
auto stage = fDst.info().colorType() == kRGBA_8888_SkColorType
|
||||
? SkRasterPipeline::srcover_rgba_8888
|
||||
: SkRasterPipeline::srcover_bgra_8888;
|
||||
p.append(stage, &fDstPtr);
|
||||
#endif
|
||||
} else {
|
||||
if (fBlend != SkBlendMode::kSrc) {
|
||||
this->append_load_dst(&p);
|
||||
|
@ -199,7 +199,7 @@ extern "C" {
|
||||
LOWP(load_g8) LOWP(load_g8_dst)
|
||||
LOWP(load_565) LOWP(load_565_dst) LOWP(store_565)
|
||||
LOWP(swap_rb)
|
||||
LOWP(srcover_rgba_8888)
|
||||
LOWP(srcover_rgba_8888) LOWP(srcover_bgra_8888)
|
||||
LOWP(lerp_1_float)
|
||||
LOWP(lerp_u8)
|
||||
LOWP(lerp_565)
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -502,6 +502,30 @@ 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]
|
||||
|
||||
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(b, 1.0f)
|
||||
| round(g, 1.0f) << 8
|
||||
| round(r, 1.0f) << 16
|
||||
| round(a, 1.0f) << 24;
|
||||
store(ptr, dst, tail);
|
||||
}
|
||||
|
||||
STAGE(clamp_0, Ctx::None) {
|
||||
r = max(r, 0);
|
||||
g = max(g, 0);
|
||||
|
@ -696,5 +696,15 @@ 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);
|
||||
}
|
||||
|
||||
#endif//defined(__clang__)
|
||||
|
Loading…
Reference in New Issue
Block a user