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:
Brian Osman 2018-10-12 11:18:02 -04:00 committed by Skia Commit-Bot
parent bd68adfdcb
commit be686f0773
2 changed files with 7 additions and 21 deletions

View File

@ -254,14 +254,8 @@ GrTexture* SkImage_GpuBase::onGetTexture() const {
} }
sk_sp<SkImage> SkImage_GpuBase::onMakeColorSpace(sk_sp<SkColorSpace> target) const { sk_sp<SkImage> SkImage_GpuBase::onMakeColorSpace(sk_sp<SkColorSpace> target) const {
SkAlphaType newAlphaType = fAlphaType; auto xform = GrColorSpaceXformEffect::Make(fColorSpace.get(), fAlphaType,
#if defined(SK_LEGACY_MAKE_COLOR_SPACE_IMPL) target.get(), fAlphaType);
if (kUnpremul_SkAlphaType == fAlphaType) {
newAlphaType = kPremul_SkAlphaType;
}
#endif
auto xform = GrColorSpaceXformEffect::Make(fColorSpace.get(), this->alphaType(),
target.get(), newAlphaType);
if (!xform) { if (!xform) {
return sk_ref_sp(const_cast<SkImage_GpuBase*>(this)); 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 // MDB: this call is okay bc we know 'renderTargetContext' was exact
return sk_make_sp<SkImage_Gpu>(fContext, kNeedNewImageUniqueID, return sk_make_sp<SkImage_Gpu>(fContext, kNeedNewImageUniqueID,
newAlphaType, renderTargetContext->asTextureProxyRef(), fAlphaType, renderTargetContext->asTextureProxyRef(),
std::move(target), fBudgeted); std::move(target), fBudgeted);
} }

View File

@ -339,22 +339,14 @@ sk_sp<SkImage> SkImage_Raster::onMakeColorSpace(sk_sp<SkColorSpace> target) cons
SkAssertResult(fBitmap.peekPixels(&src)); SkAssertResult(fBitmap.peekPixels(&src));
// Treat nullptr srcs as sRGB. // Treat nullptr srcs as sRGB.
if (!src.colorSpace()) { if (!src.colorSpace() && target->isSRGB()) {
if (target->isSRGB()) { return sk_ref_sp(const_cast<SkImage*>((SkImage*)this));
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; SkBitmap dst;
dst.allocPixels(dstInfo); dst.allocPixels(fBitmap.info().makeColorSpace(target));
SkAssertResult(dst.writePixels(src, 0, 0)); SkAssertResult(dst.writePixels(src));
dst.setImmutable(); dst.setImmutable();
return SkImage::MakeFromBitmap(dst); return SkImage::MakeFromBitmap(dst);
} }