Remove legacy makeColorSpace implementation
Chrome has rebaselined against the new implementation Bug: skia:8382 Change-Id: I6896cda4a970ba061cd26ba20358cd842f6bf83d Reviewed-on: https://skia-review.googlesource.com/c/161820 Commit-Queue: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@google.com> Auto-Submit: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
bd68adfdcb
commit
be686f0773
@ -254,14 +254,8 @@ GrTexture* SkImage_GpuBase::onGetTexture() const {
|
||||
}
|
||||
|
||||
sk_sp<SkImage> SkImage_GpuBase::onMakeColorSpace(sk_sp<SkColorSpace> target) const {
|
||||
SkAlphaType newAlphaType = fAlphaType;
|
||||
#if defined(SK_LEGACY_MAKE_COLOR_SPACE_IMPL)
|
||||
if (kUnpremul_SkAlphaType == fAlphaType) {
|
||||
newAlphaType = kPremul_SkAlphaType;
|
||||
}
|
||||
#endif
|
||||
auto xform = GrColorSpaceXformEffect::Make(fColorSpace.get(), this->alphaType(),
|
||||
target.get(), newAlphaType);
|
||||
auto xform = GrColorSpaceXformEffect::Make(fColorSpace.get(), fAlphaType,
|
||||
target.get(), fAlphaType);
|
||||
if (!xform) {
|
||||
return sk_ref_sp(const_cast<SkImage_GpuBase*>(this));
|
||||
}
|
||||
@ -289,7 +283,7 @@ sk_sp<SkImage> SkImage_GpuBase::onMakeColorSpace(sk_sp<SkColorSpace> target) con
|
||||
|
||||
// MDB: this call is okay bc we know 'renderTargetContext' was exact
|
||||
return sk_make_sp<SkImage_Gpu>(fContext, kNeedNewImageUniqueID,
|
||||
newAlphaType, renderTargetContext->asTextureProxyRef(),
|
||||
fAlphaType, renderTargetContext->asTextureProxyRef(),
|
||||
std::move(target), fBudgeted);
|
||||
}
|
||||
|
||||
|
@ -339,22 +339,14 @@ sk_sp<SkImage> SkImage_Raster::onMakeColorSpace(sk_sp<SkColorSpace> target) cons
|
||||
SkAssertResult(fBitmap.peekPixels(&src));
|
||||
|
||||
// Treat nullptr srcs as sRGB.
|
||||
if (!src.colorSpace()) {
|
||||
if (target->isSRGB()) {
|
||||
if (!src.colorSpace() && target->isSRGB()) {
|
||||
return sk_ref_sp(const_cast<SkImage*>((SkImage*)this));
|
||||
}
|
||||
|
||||
src.setColorSpace(SkColorSpace::MakeSRGB());
|
||||
}
|
||||
|
||||
SkImageInfo dstInfo = fBitmap.info().makeColorSpace(target);
|
||||
#if defined(SK_LEGACY_MAKE_COLOR_SPACE_IMPL)
|
||||
dstInfo = dstInfo.makeColorType(kN32_SkColorType);
|
||||
#endif
|
||||
SkBitmap dst;
|
||||
dst.allocPixels(dstInfo);
|
||||
dst.allocPixels(fBitmap.info().makeColorSpace(target));
|
||||
|
||||
SkAssertResult(dst.writePixels(src, 0, 0));
|
||||
SkAssertResult(dst.writePixels(src));
|
||||
dst.setImmutable();
|
||||
return SkImage::MakeFromBitmap(dst);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user