Preserve color space of images in deferred texture API
For raster images, this already worked (we were peeking the pixmap's info). But for generated images, we discarded format and color space information. Fixes an error with the deferred GMs in sRGB modes, and also should help the Chrome color correctness work. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2416453004 Review-Url: https://codereview.chromium.org/2416453004
This commit is contained in:
parent
98b2e7a9e4
commit
32b5e70178
@ -492,7 +492,7 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox
|
|||||||
if (!data && !this->peekPixels(nullptr)) {
|
if (!data && !this->peekPixels(nullptr)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
info = SkImageInfo::MakeN32(scaledSize.width(), scaledSize.height(), this->alphaType());
|
info = as_IB(this)->onImageInfo().makeWH(scaledSize.width(), scaledSize.height());
|
||||||
pixelSize = SkAlign8(SkAutoPixmapStorage::AllocSize(info, nullptr));
|
pixelSize = SkAlign8(SkAutoPixmapStorage::AllocSize(info, nullptr));
|
||||||
if (fillMode) {
|
if (fillMode) {
|
||||||
pixmap.alloc(info);
|
pixmap.alloc(info);
|
||||||
@ -509,7 +509,6 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox
|
|||||||
SkASSERT(!pixmap.ctable());
|
SkASSERT(!pixmap.ctable());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SkAlphaType at = this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
|
|
||||||
int mipMapLevelCount = 1;
|
int mipMapLevelCount = 1;
|
||||||
if (useMipMaps) {
|
if (useMipMaps) {
|
||||||
// SkMipMap only deals with the mipmap levels it generates, which does
|
// SkMipMap only deals with the mipmap levels it generates, which does
|
||||||
@ -528,7 +527,7 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox
|
|||||||
currentMipMapLevelIndex--) {
|
currentMipMapLevelIndex--) {
|
||||||
SkISize mipSize = SkMipMap::ComputeLevelSize(scaledSize.width(), scaledSize.height(),
|
SkISize mipSize = SkMipMap::ComputeLevelSize(scaledSize.width(), scaledSize.height(),
|
||||||
currentMipMapLevelIndex);
|
currentMipMapLevelIndex);
|
||||||
SkImageInfo mipInfo = SkImageInfo::MakeN32(mipSize.fWidth, mipSize.fHeight, at);
|
SkImageInfo mipInfo = info.makeWH(mipSize.fWidth, mipSize.fHeight);
|
||||||
pixelSize += SkAlign8(SkAutoPixmapStorage::AllocSize(mipInfo, nullptr));
|
pixelSize += SkAlign8(SkAutoPixmapStorage::AllocSize(mipInfo, nullptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -614,10 +613,6 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox
|
|||||||
// range 0-(x-1).
|
// range 0-(x-1).
|
||||||
for (int generatedMipLevelIndex = 0; generatedMipLevelIndex < mipMapLevelCount - 1;
|
for (int generatedMipLevelIndex = 0; generatedMipLevelIndex < mipMapLevelCount - 1;
|
||||||
generatedMipLevelIndex++) {
|
generatedMipLevelIndex++) {
|
||||||
SkISize mipSize = SkMipMap::ComputeLevelSize(scaledSize.width(), scaledSize.height(),
|
|
||||||
generatedMipLevelIndex);
|
|
||||||
|
|
||||||
SkImageInfo mipInfo = SkImageInfo::MakeN32(mipSize.fWidth, mipSize.fHeight, at);
|
|
||||||
SkMipMap::Level mipLevel;
|
SkMipMap::Level mipLevel;
|
||||||
mipmaps->getLevel(generatedMipLevelIndex, &mipLevel);
|
mipmaps->getLevel(generatedMipLevelIndex, &mipLevel);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user