Reland "use colorspace steps to determine legacy blits"
This reverts commitc945f0e31a
. Reason for revert: looks like this did not help Original change's description: > Revert "use colorspace steps to determine legacy blits" > > This reverts commit0919852526
. > > 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> TBR=mtklein@google.com,brianosman@google.com,reed@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: skia:8793 Change-Id: I2b70c6e3763bf27112b54ed0d0611a6addc755b9 Reviewed-on: https://skia-review.googlesource.com/c/196981 Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
parent
cf27e74da0
commit
5800f2e8a9
@ -122,4 +122,17 @@ 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
|
||||
|
@ -174,3 +174,13 @@ 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;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "SkArenaAlloc.h"
|
||||
#include "SkBitmapProcShader.h"
|
||||
#include "SkColorShader.h"
|
||||
#include "SkColorSpacePriv.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkEmptyShader.h"
|
||||
#include "SkMallocPixelRef.h"
|
||||
@ -110,16 +111,7 @@ SkShaderBase::Context::Context(const SkShaderBase& shader, const ContextRec& rec
|
||||
SkShaderBase::Context::~Context() {}
|
||||
|
||||
bool SkShaderBase::ContextRec::isLegacyCompatible(SkColorSpace* shaderColorSpace) const {
|
||||
// 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);
|
||||
return sk_can_use_legacy_blits(shaderColorSpace, fDstColorSpace);
|
||||
}
|
||||
|
||||
const SkMatrix& SkShader::getLocalMatrix() const {
|
||||
|
Loading…
Reference in New Issue
Block a user