skip unpremul...premul with only linear ops between
Change-Id: I26ed83bb613a83a0fd73f2f8b868b775be1ce968 Reviewed-on: https://skia-review.googlesource.com/130121 Commit-Queue: Mike Klein <mtklein@chromium.org> Auto-Submit: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
77418559ca
commit
4a0ad501e4
@ -102,4 +102,22 @@ SkColorSpaceXformSteps::SkColorSpaceXformSteps(SkColorSpace* src, SkAlphaType sr
|
||||
this->linearize_src = false;
|
||||
this->early_encode = false;
|
||||
}
|
||||
|
||||
// Skip unpremul...premul if there are no non-linear operations between.
|
||||
if ( this->early_unpremul &&
|
||||
!this->linearize_src &&
|
||||
!this->early_encode &&
|
||||
this->premul)
|
||||
{
|
||||
this->early_unpremul = false;
|
||||
this->premul = false;
|
||||
}
|
||||
|
||||
if ( this->late_unpremul &&
|
||||
!this->early_encode &&
|
||||
this->premul)
|
||||
{
|
||||
this->late_unpremul = false;
|
||||
this->premul = false;
|
||||
}
|
||||
}
|
||||
|
@ -69,16 +69,16 @@ DEF_TEST(SkColorSpaceXformSteps, r) {
|
||||
{ adobe_L, srgb_L, kPremul_SkAlphaType,
|
||||
false, // src is encoded as f(s*a),a, so we linearize before unpremul.
|
||||
true, // Linearize,
|
||||
true, // then unpremul.
|
||||
false, // then unpremul, but we can skip this here.
|
||||
|
||||
true, // Gamut transform.
|
||||
false, // We're doing linear blending, so we don't encode to sRGB yet.
|
||||
true, // Premul so we can blend.
|
||||
false, // Premul so we can blend, but skipped because we never unpremulled.
|
||||
|
||||
true, // We're doing linear blending, so we need to linearize dst.
|
||||
true, // Once blending is done, finally encode to sRGB.
|
||||
},
|
||||
{ srgb_L, adobe_L, kPremul_SkAlphaType, false,true,true, true,false,true, true,true },
|
||||
{ srgb_L, adobe_L, kPremul_SkAlphaType, false,true,false, true,false,false, true,true },
|
||||
|
||||
{ adobe_L, srgb_N, kPremul_SkAlphaType,
|
||||
false, // src is encoded as f(s*a),a, so we linearize before unpremul.
|
||||
@ -138,8 +138,8 @@ DEF_TEST(SkColorSpaceXformSteps, r) {
|
||||
{ srgb_N, srgb22_N, kPremul_SkAlphaType, true,true,false, false,true,true, false,false },
|
||||
{ srgb22_N, srgb_N, kPremul_SkAlphaType, true,true,false, false,true,true, false,false },
|
||||
|
||||
{ srgb_L, srgb22_L, kPremul_SkAlphaType, false,true,true, false,false,true, true,true },
|
||||
{ srgb22_L, srgb_L, kPremul_SkAlphaType, false,true,true, false,false,true, true,true },
|
||||
{ srgb_L, srgb22_L, kPremul_SkAlphaType, false,true,false, false,false,false, true,true },
|
||||
{ srgb22_L, srgb_L, kPremul_SkAlphaType, false,true,false, false,false,false, true,true },
|
||||
|
||||
{ srgb_L, srgb22_N, kPremul_SkAlphaType, false,true,true, false,true,true, false,false },
|
||||
{ srgb22_L, srgb_N, kPremul_SkAlphaType, false,true,true, false,true,true, false,false },
|
||||
@ -170,10 +170,10 @@ DEF_TEST(SkColorSpaceXformSteps, r) {
|
||||
|
||||
// These four test cases test drawing in the same color space.
|
||||
// There is lots of room for optimization here.
|
||||
{ srgb_N, srgb_N, kPremul_SkAlphaType, true,false,false, false,false,true, false,false },
|
||||
{ srgb_L, srgb_L, kPremul_SkAlphaType, false,true,true, false,false,true, true,true },
|
||||
{ srgb_L, srgb_N, kPremul_SkAlphaType, false,true,true, false,true,true, false,false },
|
||||
{ srgb_N, srgb_L, kPremul_SkAlphaType, true,true,false, false,false,true, true,true },
|
||||
{ srgb_N, srgb_N, kPremul_SkAlphaType, false,false,false, false,false,false, false,false},
|
||||
{ srgb_L, srgb_L, kPremul_SkAlphaType, false,true,false, false,false,false, true,true },
|
||||
{ srgb_L, srgb_N, kPremul_SkAlphaType, false,true,true, false,true,true, false,false},
|
||||
{ srgb_N, srgb_L, kPremul_SkAlphaType, true,true,false, false,false,true, true,true },
|
||||
|
||||
// And the usual variants for opaque + unpremul sources.
|
||||
{ srgb_N, srgb_N, kOpaque_SkAlphaType, false,false,false, false,false,false, false,false},
|
||||
|
Loading…
Reference in New Issue
Block a user