Hoist color space xform creation out of GrTextureProducer
Bug: skia:
Change-Id: I3f43d7c7277758d8ceec7f3263d94df63cb12d8a
Reviewed-on: https://skia-review.googlesource.com/c/164441
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index affd8a5..8bbcd52 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -114,8 +114,7 @@
const SkRect& constraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrSamplerState::Filter* filterOrNullForBicubic,
- SkColorSpace* dstColorSpace) {
+ const GrSamplerState::Filter* filterOrNullForBicubic) {
SkMatrix textureMatrix = origTextureMatrix;
SkRect domain;
@@ -154,7 +153,6 @@
}
SkASSERT(kNoDomain_DomainMode == domainMode ||
(domain.fLeft <= domain.fRight && domain.fTop <= domain.fBottom));
- auto fp = CreateFragmentProcessorForDomainAndFilter(std::move(proxy), textureMatrix,
- domainMode, domain, filterOrNullForBicubic);
- return GrColorSpaceXformEffect::Make(std::move(fp), fColorSpace, fAlphaType, dstColorSpace);
+ return CreateFragmentProcessorForDomainAndFilter(std::move(proxy), textureMatrix, domainMode,
+ domain, filterOrNullForBicubic);
}
diff --git a/src/gpu/GrTextureAdjuster.h b/src/gpu/GrTextureAdjuster.h
index 639e212..ec008e7 100644
--- a/src/gpu/GrTextureAdjuster.h
+++ b/src/gpu/GrTextureAdjuster.h
@@ -25,8 +25,7 @@
const SkRect& constraintRect,
FilterConstraint,
bool coordsLimitedToConstraintRect,
- const GrSamplerState::Filter* filterOrNullForBicubic,
- SkColorSpace* dstColorSpace) override;
+ const GrSamplerState::Filter* filterOrNullForBicubic) override;
// We do not ref the texture nor the colorspace, so the caller must keep them in scope while
// this Adjuster is alive.
diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp
index b373306..9f4651f 100644
--- a/src/gpu/GrTextureMaker.cpp
+++ b/src/gpu/GrTextureMaker.cpp
@@ -107,8 +107,7 @@
const SkRect& constraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrSamplerState::Filter* filterOrNullForBicubic,
- SkColorSpace* dstColorSpace) {
+ const GrSamplerState::Filter* filterOrNullForBicubic) {
const GrSamplerState::Filter* fmForDetermineDomain = filterOrNullForBicubic;
if (filterOrNullForBicubic && GrSamplerState::Filter::kMipMap == *filterOrNullForBicubic &&
kYes_FilterConstraint == filterConstraint) {
@@ -140,8 +139,6 @@
DetermineDomainMode(constraintRect, filterConstraint, coordsLimitedToConstraintRect,
proxy.get(), fmForDetermineDomain, &domain);
SkASSERT(kTightCopy_DomainMode != domainMode);
- auto fp = CreateFragmentProcessorForDomainAndFilter(std::move(proxy), adjustedMatrix,
- domainMode, domain, filterOrNullForBicubic);
- return GrColorSpaceXformEffect::Make(std::move(fp), this->colorSpace(), this->alphaType(),
- dstColorSpace);
+ return CreateFragmentProcessorForDomainAndFilter(std::move(proxy), adjustedMatrix, domainMode,
+ domain, filterOrNullForBicubic);
}
diff --git a/src/gpu/GrTextureMaker.h b/src/gpu/GrTextureMaker.h
index 04bb487..e79b976 100644
--- a/src/gpu/GrTextureMaker.h
+++ b/src/gpu/GrTextureMaker.h
@@ -23,8 +23,7 @@
const SkRect& constraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrSamplerState::Filter* filterOrNullForBicubic,
- SkColorSpace* dstColorSpace) override;
+ const GrSamplerState::Filter* filterOrNullForBicubic) override;
protected:
GrTextureMaker(GrContext* context, int width, int height, bool isAlphaOnly)
diff --git a/src/gpu/GrTextureProducer.h b/src/gpu/GrTextureProducer.h
index 83795f4..1994f8b 100644
--- a/src/gpu/GrTextureProducer.h
+++ b/src/gpu/GrTextureProducer.h
@@ -67,8 +67,7 @@
const SkRect& constraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrSamplerState::Filter* filterOrNullForBicubic,
- SkColorSpace* dstColorSpace) = 0;
+ const GrSamplerState::Filter* filterOrNullForBicubic) = 0;
/**
* Returns a texture that is safe for use with the params.
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 17e357a..f0a6cf6 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -294,9 +294,10 @@
}
textureMatrix = &tempMatrix;
}
- auto fp = producer->createFragmentProcessor(
- *textureMatrix, clippedSrcRect, constraintMode, coordsAllInsideSrcRect, filterMode,
- fRenderTargetContext->colorSpaceInfo().colorSpace());
+ auto fp = producer->createFragmentProcessor(*textureMatrix, clippedSrcRect, constraintMode,
+ coordsAllInsideSrcRect, filterMode);
+ fp = GrColorSpaceXformEffect::Make(std::move(fp), producer->colorSpace(), producer->alphaType(),
+ fRenderTargetContext->colorSpaceInfo().colorSpace());
if (!fp) {
return;
}