Tag images as sRGB by default in SkCodec
Unmarked images should be treated as sRGB. BUG=skia:4895 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4151 Change-Id: I5f8c308d22fd2d069cbfa89c5a5bb19ae6fde8bd Reviewed-on: https://skia-review.googlesource.com/4151 Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
This commit is contained in:
parent
4d598a35cd
commit
7f650bdfd8
@ -626,7 +626,7 @@ protected:
|
||||
int height,
|
||||
const SkEncodedInfo&,
|
||||
SkStream*,
|
||||
sk_sp<SkColorSpace> = nullptr,
|
||||
sk_sp<SkColorSpace>,
|
||||
Origin = kTopLeft_Origin);
|
||||
|
||||
/**
|
||||
|
@ -583,7 +583,7 @@ SkCodec* SkBmpCodec::NewFromStream(SkStream* stream, bool inIco) {
|
||||
|
||||
SkBmpCodec::SkBmpCodec(int width, int height, const SkEncodedInfo& info, SkStream* stream,
|
||||
uint16_t bitsPerPixel, SkCodec::SkScanlineOrder rowOrder)
|
||||
: INHERITED(width, height, info, stream)
|
||||
: INHERITED(width, height, info, stream, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named))
|
||||
, fBitsPerPixel(bitsPerPixel)
|
||||
, fRowOrder(rowOrder)
|
||||
, fSrcRowBytes(SkAlign4(compute_row_bytes(width, fBitsPerPixel)))
|
||||
|
@ -98,9 +98,10 @@ SkCodec* SkGifCodec::NewFromStream(SkStream* stream) {
|
||||
// zeroes, which is arguably premultiplied.
|
||||
const auto alphaType = reader->firstFrameHasAlpha() ? kUnpremul_SkAlphaType
|
||||
: kOpaque_SkAlphaType;
|
||||
// FIXME: GIF should default to SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named).
|
||||
|
||||
const auto imageInfo = SkImageInfo::Make(reader->screenWidth(), reader->screenHeight(),
|
||||
colorType, alphaType);
|
||||
colorType, alphaType,
|
||||
SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
|
||||
return new SkGifCodec(encodedInfo, imageInfo, reader.release());
|
||||
}
|
||||
|
||||
|
@ -171,10 +171,11 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) {
|
||||
int width = codecs->operator[](maxIndex)->getInfo().width();
|
||||
int height = codecs->operator[](maxIndex)->getInfo().height();
|
||||
SkEncodedInfo info = codecs->operator[](maxIndex)->getEncodedInfo();
|
||||
SkColorSpace* colorSpace = codecs->operator[](maxIndex)->getInfo().colorSpace();
|
||||
|
||||
// Note that stream is owned by the embedded codec, the ico does not need
|
||||
// direct access to the stream.
|
||||
return new SkIcoCodec(width, height, info, codecs.release());
|
||||
return new SkIcoCodec(width, height, info, codecs.release(), sk_ref_sp(colorSpace));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -182,8 +183,9 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) {
|
||||
* Called only by NewFromStream
|
||||
*/
|
||||
SkIcoCodec::SkIcoCodec(int width, int height, const SkEncodedInfo& info,
|
||||
SkTArray<SkAutoTDelete<SkCodec>, true>* codecs)
|
||||
: INHERITED(width, height, info, nullptr)
|
||||
SkTArray<SkAutoTDelete<SkCodec>, true>* codecs,
|
||||
sk_sp<SkColorSpace> colorSpace)
|
||||
: INHERITED(width, height, info, nullptr, std::move(colorSpace))
|
||||
, fEmbeddedCodecs(codecs)
|
||||
, fCurrScanlineCodec(nullptr)
|
||||
, fCurrIncrementalCodec(nullptr)
|
||||
|
@ -77,7 +77,7 @@ private:
|
||||
* @param embeddedCodecs codecs for the embedded images, takes ownership
|
||||
*/
|
||||
SkIcoCodec(int width, int height, const SkEncodedInfo& info,
|
||||
SkTArray<SkAutoTDelete<SkCodec>, true>* embeddedCodecs);
|
||||
SkTArray<SkAutoTDelete<SkCodec>, true>* embeddedCodecs, sk_sp<SkColorSpace> colorSpace);
|
||||
|
||||
SkAutoTDelete<SkTArray<SkAutoTDelete<SkCodec>, true>> fEmbeddedCodecs; // owned
|
||||
|
||||
|
@ -778,5 +778,6 @@ bool SkRawCodec::onDimensionsSupported(const SkISize& dim) {
|
||||
SkRawCodec::~SkRawCodec() {}
|
||||
|
||||
SkRawCodec::SkRawCodec(SkDngImage* dngImage)
|
||||
: INHERITED(dngImage->width(), dngImage->height(), dngImage->getEncodedInfo(), nullptr)
|
||||
: INHERITED(dngImage->width(), dngImage->height(), dngImage->getEncodedInfo(), nullptr,
|
||||
SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named))
|
||||
, fDngImage(dngImage) {}
|
||||
|
@ -105,7 +105,7 @@ bool SkWbmpCodec::readRow(uint8_t* row) {
|
||||
}
|
||||
|
||||
SkWbmpCodec::SkWbmpCodec(int width, int height, const SkEncodedInfo& info, SkStream* stream)
|
||||
: INHERITED(width, height, info, stream)
|
||||
: INHERITED(width, height, info, stream, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named))
|
||||
, fSrcRowBytes(get_src_row_bytes(this->getInfo().width()))
|
||||
, fSwizzler(nullptr)
|
||||
, fColorTable(nullptr)
|
||||
|
Loading…
Reference in New Issue
Block a user