Revert "use colorspace steps to determine legacy blits"

This reverts commit 0919852526.

Reason for revert: speculative: unblock android roll

Original change's description:
> use colorspace steps to determine legacy blits
> 
> Bug: skia:8793
> Change-Id: I1de4bde25f7dcb12175733a3213c43f92410dc4a
> Reviewed-on: https://skia-review.googlesource.com/c/196647
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=mtklein@google.com,brianosman@google.com,reed@google.com

Change-Id: I79a21df9a3c3a9f3127f57131feff0f3e417e642
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8793
Reviewed-on: https://skia-review.googlesource.com/c/196774
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2019-03-02 17:52:25 +00:00 committed by Skia Commit-Bot
parent 9159c8ef83
commit c945f0e31a
3 changed files with 10 additions and 25 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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 {