diff --git a/src/core/SkColorSpacePriv.h b/src/core/SkColorSpacePriv.h index 9ff9c3ac20..12379d7c33 100644 --- a/src/core/SkColorSpacePriv.h +++ b/src/core/SkColorSpacePriv.h @@ -122,17 +122,4 @@ static inline bool is_almost_linear(const skcms_TransferFunction& coeffs) { SkColorSpace* sk_srgb_singleton(); SkColorSpace* sk_srgb_linear_singleton(); -/** - * Returns true if the combination of src and dst colorspaces result in basically a no-op, - * and thus we will generate correct results if we ignore both colorspaces (as we did in the - * legacy world of blits). - * - * Some examples: - * dst == null returns true: this is the classic definition of our legacy blits - * dst == src returns true: going through the new process is effectively a no-op - * src == null treats src as sRGB... - */ -bool sk_can_use_legacy_blits(SkColorSpace* src, SkColorSpace* dst); - - #endif // SkColorSpacePriv_DEFINED diff --git a/src/core/SkColorSpaceXformSteps.cpp b/src/core/SkColorSpaceXformSteps.cpp index 7f0d5fb960..6e318149d7 100644 --- a/src/core/SkColorSpaceXformSteps.cpp +++ b/src/core/SkColorSpaceXformSteps.cpp @@ -174,13 +174,3 @@ void SkColorSpaceXformSteps::apply(SkRasterPipeline* p, bool src_is_normalized) } if (flags.premul) { p->append(SkRasterPipeline::premul); } } - -////////////// - -bool sk_can_use_legacy_blits(SkColorSpace* src, SkColorSpace* dst) { - // When considering legacy blits, we only supported premul, so set those here - SkAlphaType srcAT = kPremul_SkAlphaType; - SkAlphaType dstAT = kPremul_SkAlphaType; - - return SkColorSpaceXformSteps(src, srcAT, dst, dstAT).flags.mask() == 0; -} diff --git a/src/shaders/SkShader.cpp b/src/shaders/SkShader.cpp index 1f4114e163..b75da92023 100644 --- a/src/shaders/SkShader.cpp +++ b/src/shaders/SkShader.cpp @@ -8,7 +8,6 @@ #include "SkArenaAlloc.h" #include "SkBitmapProcShader.h" #include "SkColorShader.h" -#include "SkColorSpacePriv.h" #include "SkColorSpaceXformer.h" #include "SkEmptyShader.h" #include "SkMallocPixelRef.h" @@ -111,7 +110,16 @@ SkShaderBase::Context::Context(const SkShaderBase& shader, const ContextRec& rec SkShaderBase::Context::~Context() {} bool SkShaderBase::ContextRec::isLegacyCompatible(SkColorSpace* shaderColorSpace) const { - return sk_can_use_legacy_blits(shaderColorSpace, fDstColorSpace); + // Compatible means that the shader's (unmodified) colors will blend correctly with the + // device in the legacy mode where the colorspaces (of src and dst) are ignored. + if (fDstColorSpace == nullptr) { + return true; // untagged dst is by definition compatible with untagged/ignored src + } + if (shaderColorSpace == nullptr) { + // we treat untagged src as being srgb (e.g. SkColor) + return fDstColorSpace->isSRGB(); + } + return SkColorSpace::Equals(shaderColorSpace, fDstColorSpace); } const SkMatrix& SkShader::getLocalMatrix() const {