From be686f0773fc5a9a341f058e992c2dacb4600d60 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Fri, 12 Oct 2018 11:18:02 -0400 Subject: [PATCH] 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 Commit-Queue: Mike Klein Auto-Submit: Brian Osman Reviewed-by: Mike Klein --- src/image/SkImage_GpuBase.cpp | 12 +++--------- src/image/SkImage_Raster.cpp | 16 ++++------------ 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp index a718fdb3d6..66f91e3cee 100644 --- a/src/image/SkImage_GpuBase.cpp +++ b/src/image/SkImage_GpuBase.cpp @@ -254,14 +254,8 @@ GrTexture* SkImage_GpuBase::onGetTexture() const { } sk_sp SkImage_GpuBase::onMakeColorSpace(sk_sp 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(this)); } @@ -289,7 +283,7 @@ sk_sp SkImage_GpuBase::onMakeColorSpace(sk_sp target) con // MDB: this call is okay bc we know 'renderTargetContext' was exact return sk_make_sp(fContext, kNeedNewImageUniqueID, - newAlphaType, renderTargetContext->asTextureProxyRef(), + fAlphaType, renderTargetContext->asTextureProxyRef(), std::move(target), fBudgeted); } diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp index 9636b1d112..8b4769c3da 100644 --- a/src/image/SkImage_Raster.cpp +++ b/src/image/SkImage_Raster.cpp @@ -339,22 +339,14 @@ sk_sp SkImage_Raster::onMakeColorSpace(sk_sp target) cons SkAssertResult(fBitmap.peekPixels(&src)); // Treat nullptr srcs as sRGB. - if (!src.colorSpace()) { - if (target->isSRGB()) { - return sk_ref_sp(const_cast((SkImage*)this)); - } - - src.setColorSpace(SkColorSpace::MakeSRGB()); + if (!src.colorSpace() && target->isSRGB()) { + return sk_ref_sp(const_cast((SkImage*)this)); } - 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); }