Use non-linear color spaces for Android decode outputs
BUG=skia: Change-Id: Ic4bce28f4bc45f73cbfcacc3630140d11fa9c41f Reviewed-on: https://skia-review.googlesource.com/8530 Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Matt Sarett <msarett@google.com>
This commit is contained in:
parent
0c8f7a335e
commit
5444446b75
@ -176,10 +176,13 @@ sk_sp<SkColorSpace> SkAndroidCodec::computeOutputColorSpace(SkColorType outputCo
|
||||
case kIndex_8_SkColorType:
|
||||
if (is_wide_gamut(fCodec->getInfo().colorSpace())) {
|
||||
return SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
|
||||
SkColorSpace::kDCIP3_D65_Gamut);
|
||||
SkColorSpace::kDCIP3_D65_Gamut,
|
||||
SkColorSpace::kNonLinearBlending_ColorSpaceFlag);
|
||||
}
|
||||
|
||||
return SkColorSpace::MakeSRGB();
|
||||
return SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
|
||||
SkColorSpace::kSRGB_Gamut,
|
||||
SkColorSpace::kNonLinearBlending_ColorSpaceFlag);
|
||||
case kRGBA_F16_SkColorType:
|
||||
return SkColorSpace::MakeSRGBLinear();
|
||||
default:
|
||||
|
@ -474,7 +474,17 @@ void SkCodec::fillIncompleteImage(const SkImageInfo& info, void* dst, size_t row
|
||||
}
|
||||
}
|
||||
|
||||
bool SkCodec::initializeColorXform(const SkImageInfo& dstInfo) {
|
||||
bool SkCodec::initializeColorXform(const SkImageInfo& info) {
|
||||
// TODO (msarett):
|
||||
// Handle equality checking and legacy behavior for flagged SkColorSpaces.
|
||||
// Until this is implemented, remove any flags on output color spaces. This
|
||||
// will prevent strange behaviors. Ex: sRGB != sRGB + flag, but we don't want
|
||||
// this to trigger a color xform.
|
||||
SkImageInfo dstInfo = info;
|
||||
if (dstInfo.colorSpace()) {
|
||||
dstInfo = info.makeColorSpace(as_CSB(dstInfo.colorSpace())->makeWithoutFlags());
|
||||
}
|
||||
|
||||
fColorXform = nullptr;
|
||||
bool needsPremul = needs_premul(dstInfo, fEncodedInfo);
|
||||
if (needs_color_xform(dstInfo, fSrcInfo, needsPremul)) {
|
||||
|
@ -297,6 +297,19 @@ bool SkColorSpace::toXYZD50(SkMatrix44* toXYZD50) const {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sk_sp<SkColorSpace> SkColorSpace_Base::makeWithoutFlags() {
|
||||
if (!fFlags) {
|
||||
return sk_ref_sp(this);
|
||||
}
|
||||
|
||||
SkASSERT(Type::kXYZ == this->type());
|
||||
SkColorSpaceTransferFn fn;
|
||||
SkAssertResult(this->onIsNumericalTransferFn(&fn));
|
||||
return SkColorSpace::MakeRGB(fn, *this->toXYZD50(), 0);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum Version {
|
||||
k0_Version, // Initial version, header + flags for matrix and profile
|
||||
};
|
||||
|
@ -178,6 +178,8 @@ public:
|
||||
*/
|
||||
virtual sk_sp<SkColorSpace> makeSRGBGamma() = 0;
|
||||
|
||||
sk_sp<SkColorSpace> makeWithoutFlags();
|
||||
|
||||
enum class Type : uint8_t {
|
||||
kXYZ,
|
||||
kA2B
|
||||
|
Loading…
Reference in New Issue
Block a user