Revert "Add support for unpremul image sources in the GPU backend"
This reverts commit f06240de2c4583c8d8ef2e798dd4636e6cfe8f47.
Reason for revert: I think this requires the skcms codec change to re-land,
Original change's description:
> Add support for unpremul image sources in the GPU backend
>
> Change-Id: Ib940fa0d658fff0b2dd923abfcc5ca4a49b2b38b
> Reviewed-on: https://skia-review.googlesource.com/148397
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,bsalomon@google.com,brianosman@google.com
Change-Id: Ib9358cf858c3c0887322503a4b021e08a0ac4cd5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/148861
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index b6ed9b3..cc5803f 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -316,7 +316,7 @@
// object. If that produces something, then both are tagged, and the source is in a different
// gamut than the dest. There is some overhead to making the xform, but those are cached, and
// if we get one back, that means we're about to use it during the conversion anyway.
- auto colorSpaceXform = GrColorSpaceXform::Make(src->getColorSpace(), src->alphaType(),
+ auto colorSpaceXform = GrColorSpaceXform::Make(src->getColorSpace(), kPremul_SkAlphaType,
outProps.colorSpace(), kPremul_SkAlphaType);
if (!colorSpaceXform) {
diff --git a/src/effects/SkToSRGBColorFilter.cpp b/src/effects/SkToSRGBColorFilter.cpp
index 4b5558d..d5fdec0 100644
--- a/src/effects/SkToSRGBColorFilter.cpp
+++ b/src/effects/SkToSRGBColorFilter.cpp
@@ -52,7 +52,6 @@
#if SK_SUPPORT_GPU
std::unique_ptr<GrFragmentProcessor> SkToSRGBColorFilter::asFragmentProcessor(
GrContext*, const GrColorSpaceInfo&) const {
- return GrColorSpaceXformEffect::Make(fSrcColorSpace.get(), kPremul_SkAlphaType,
- sk_srgb_singleton());
+ return GrColorSpaceXformEffect::Make(fSrcColorSpace.get(), sk_srgb_singleton());
}
#endif
diff --git a/src/effects/imagefilters/SkAlphaThresholdFilter.cpp b/src/effects/imagefilters/SkAlphaThresholdFilter.cpp
index 4e2b0f4..9dc8ae4 100644
--- a/src/effects/imagefilters/SkAlphaThresholdFilter.cpp
+++ b/src/effects/imagefilters/SkAlphaThresholdFilter.cpp
@@ -176,7 +176,7 @@
const OutputProperties& outProps = ctx.outputProperties();
auto textureFP = GrSimpleTextureEffect::Make(std::move(inputProxy), SkMatrix::I());
textureFP = GrColorSpaceXformEffect::Make(std::move(textureFP), input->getColorSpace(),
- input->alphaType(), outProps.colorSpace());
+ outProps.colorSpace());
if (!textureFP) {
return nullptr;
}
diff --git a/src/effects/imagefilters/SkArithmeticImageFilter.cpp b/src/effects/imagefilters/SkArithmeticImageFilter.cpp
index 644494e..e392d55 100644
--- a/src/effects/imagefilters/SkArithmeticImageFilter.cpp
+++ b/src/effects/imagefilters/SkArithmeticImageFilter.cpp
@@ -316,7 +316,6 @@
GrTextureDomain::MakeTexelDomain(background->subset()),
GrTextureDomain::kDecal_Mode, GrSamplerState::Filter::kNearest);
bgFP = GrColorSpaceXformEffect::Make(std::move(bgFP), background->getColorSpace(),
- background->alphaType(),
outputProperties.colorSpace());
} else {
bgFP = GrConstColorProcessor::Make(GrColor4f::TransparentBlack(),
@@ -332,7 +331,6 @@
GrTextureDomain::kDecal_Mode, GrSamplerState::Filter::kNearest);
foregroundFP = GrColorSpaceXformEffect::Make(std::move(foregroundFP),
foreground->getColorSpace(),
- foreground->alphaType(),
outputProperties.colorSpace());
paint.addColorFragmentProcessor(std::move(foregroundFP));
diff --git a/src/effects/imagefilters/SkDisplacementMapEffect.cpp b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
index 9a2d054..92ac807 100644
--- a/src/effects/imagefilters/SkDisplacementMapEffect.cpp
+++ b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
@@ -306,8 +306,7 @@
offsetMatrix,
std::move(colorProxy),
SkISize::Make(color->width(), color->height()));
- fp = GrColorSpaceXformEffect::Make(std::move(fp), color->getColorSpace(),
- color->alphaType(), colorSpace);
+ fp = GrColorSpaceXformEffect::Make(std::move(fp), color->getColorSpace(), colorSpace);
GrPaint paint;
paint.addColorFragmentProcessor(std::move(fp));
diff --git a/src/effects/imagefilters/SkMagnifierImageFilter.cpp b/src/effects/imagefilters/SkMagnifierImageFilter.cpp
index c17e8fa..88d7862 100644
--- a/src/effects/imagefilters/SkMagnifierImageFilter.cpp
+++ b/src/effects/imagefilters/SkMagnifierImageFilter.cpp
@@ -115,7 +115,7 @@
bounds.width() * invInset,
bounds.height() * invInset);
fp = GrColorSpaceXformEffect::Make(std::move(fp), input->getColorSpace(),
- input->alphaType(), ctx.outputProperties().colorSpace());
+ ctx.outputProperties().colorSpace());
if (!fp) {
return nullptr;
}
diff --git a/src/effects/imagefilters/SkXfermodeImageFilter.cpp b/src/effects/imagefilters/SkXfermodeImageFilter.cpp
index 9dc577d..cc5cacb 100644
--- a/src/effects/imagefilters/SkXfermodeImageFilter.cpp
+++ b/src/effects/imagefilters/SkXfermodeImageFilter.cpp
@@ -286,7 +286,6 @@
GrTextureDomain::kDecal_Mode,
GrSamplerState::Filter::kNearest);
bgFP = GrColorSpaceXformEffect::Make(std::move(bgFP), background->getColorSpace(),
- background->alphaType(),
outputProperties.colorSpace());
} else {
bgFP = GrConstColorProcessor::Make(GrColor4f::TransparentBlack(),
@@ -302,7 +301,6 @@
GrTextureDomain::kDecal_Mode, GrSamplerState::Filter::kNearest);
foregroundFP = GrColorSpaceXformEffect::Make(std::move(foregroundFP),
foreground->getColorSpace(),
- foreground->alphaType(),
outputProperties.colorSpace());
paint.addColorFragmentProcessor(std::move(foregroundFP));
diff --git a/src/gpu/GrColorSpaceXform.cpp b/src/gpu/GrColorSpaceXform.cpp
index c900923..7bb8a56 100644
--- a/src/gpu/GrColorSpaceXform.cpp
+++ b/src/gpu/GrColorSpaceXform.cpp
@@ -156,9 +156,8 @@
}
std::unique_ptr<GrFragmentProcessor> GrColorSpaceXformEffect::Make(SkColorSpace* src,
- SkAlphaType srcAT,
SkColorSpace* dst) {
- auto xform = GrColorSpaceXform::Make(src, srcAT,
+ auto xform = GrColorSpaceXform::Make(src, kPremul_SkAlphaType,
dst, kPremul_SkAlphaType);
if (!xform) {
return nullptr;
@@ -170,12 +169,12 @@
std::unique_ptr<GrFragmentProcessor> GrColorSpaceXformEffect::Make(
std::unique_ptr<GrFragmentProcessor> child,
- SkColorSpace* src, SkAlphaType srcAT, SkColorSpace* dst) {
+ SkColorSpace* src, SkColorSpace* dst) {
if (!child) {
return nullptr;
}
- auto xform = GrColorSpaceXform::Make(src, srcAT,
+ auto xform = GrColorSpaceXform::Make(src, kPremul_SkAlphaType,
dst, kPremul_SkAlphaType);
if (!xform) {
return child;
diff --git a/src/gpu/GrColorSpaceXform.h b/src/gpu/GrColorSpaceXform.h
index d824dcd..b55c9dd 100644
--- a/src/gpu/GrColorSpaceXform.h
+++ b/src/gpu/GrColorSpaceXform.h
@@ -51,16 +51,14 @@
/**
* Returns a fragment processor that converts the input's color space from src to dst.
*/
- static std::unique_ptr<GrFragmentProcessor> Make(SkColorSpace* src, SkAlphaType srcAT,
- SkColorSpace* dst);
+ static std::unique_ptr<GrFragmentProcessor> Make(SkColorSpace* src, SkColorSpace* dst);
/**
* Returns a fragment processor that calls the passed in fragment processor, and then converts
* the color space of the output from src to dst.
*/
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> child,
- SkColorSpace* src, SkAlphaType srcAT,
- SkColorSpace* dst);
+ SkColorSpace* src, SkColorSpace* dst);
const char* name() const override { return "ColorSpaceXform"; }
std::unique_ptr<GrFragmentProcessor> clone() const override;
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index 0f65b5b..b2fc058 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -162,5 +162,5 @@
(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 GrColorSpaceXformEffect::Make(std::move(fp), fColorSpace, dstColorSpace);
}
diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp
index 16bcefa..820e47a 100644
--- a/src/gpu/GrTextureMaker.cpp
+++ b/src/gpu/GrTextureMaker.cpp
@@ -152,6 +152,5 @@
SkASSERT(kTightCopy_DomainMode != domainMode);
auto fp = CreateFragmentProcessorForDomainAndFilter(std::move(proxy), adjustedMatrix,
domainMode, domain, filterOrNullForBicubic);
- return GrColorSpaceXformEffect::Make(std::move(fp), texColorSpace.get(), this->alphaType(),
- dstColorSpace);
+ return GrColorSpaceXformEffect::Make(std::move(fp), texColorSpace.get(), dstColorSpace);
}
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index 9ffd8a7..3c6c7f7 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -130,7 +130,7 @@
// If the caller expects the pixels in a different color space than the one from the image,
// apply a color conversion to do this.
std::unique_ptr<GrFragmentProcessor> colorConversionProcessor =
- GrColorSpaceXformEffect::Make(srcColorSpace, kPremul_SkAlphaType, dstColorSpace);
+ GrColorSpaceXformEffect::Make(srcColorSpace, dstColorSpace);
if (colorConversionProcessor) {
paint.addColorFragmentProcessor(std::move(colorConversionProcessor));
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 8c22eeb..58c1de8 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1027,7 +1027,7 @@
fp = GrSimpleTextureEffect::Make(std::move(proxy), texMatrix, samplerState);
}
- fp = GrColorSpaceXformEffect::Make(std::move(fp), bitmap.colorSpace(), bitmap.alphaType(),
+ fp = GrColorSpaceXformEffect::Make(std::move(fp), bitmap.colorSpace(),
fRenderTargetContext->colorSpaceInfo().colorSpace());
GrPaint grPaint;
if (!SkPaintToGrPaintWithTexture(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
@@ -1100,7 +1100,7 @@
tmpUnfiltered.setImageFilter(nullptr);
auto fp = GrSimpleTextureEffect::Make(std::move(proxy), SkMatrix::I());
- fp = GrColorSpaceXformEffect::Make(std::move(fp), result->getColorSpace(), result->alphaType(),
+ fp = GrColorSpaceXformEffect::Make(std::move(fp), result->getColorSpace(),
fRenderTargetContext->colorSpaceInfo().colorSpace());
if (GrPixelConfigIsAlphaOnly(config)) {
fp = GrFragmentProcessor::MakeInputPremulAndMulByOutput(std::move(fp));
@@ -1423,7 +1423,7 @@
if (!proxy) {
return;
}
- auto csxf = GrColorSpaceXform::Make(proxyColorSpace.get(), producer->alphaType(),
+ auto csxf = GrColorSpaceXform::Make(proxyColorSpace.get(), kPremul_SkAlphaType,
dstColorSpace, kPremul_SkAlphaType);
fRenderTargetContext->drawImageLattice(this->clip(), std::move(grPaint), this->ctm(),
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 8a90059..c916fc3 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -99,7 +99,7 @@
static void draw_texture(const SkPaint& paint, const SkMatrix& ctm, const SkRect* src,
const SkRect* dst, GrAA aa, SkCanvas::SrcRectConstraint constraint,
- sk_sp<GrTextureProxy> proxy, SkAlphaType alphaType,
+ sk_sp<GrTextureProxy> proxy,
SkColorSpace* colorSpace, const GrClip& clip, GrRenderTargetContext* rtc) {
SkASSERT(!(SkToBool(src) && !SkToBool(dst)));
SkRect srcRect = src ? *src : SkRect::MakeWH(proxy->width(), proxy->height());
@@ -112,7 +112,7 @@
srcToDst.mapRect(&dstRect, srcRect);
}
auto textureXform =
- GrColorSpaceXform::Make(colorSpace , alphaType,
+ GrColorSpaceXform::Make(colorSpace , kPremul_SkAlphaType,
rtc->colorSpaceInfo().colorSpace(), kPremul_SkAlphaType);
GrSamplerState::Filter filter;
switch (paint.getFilterQuality()) {
@@ -150,7 +150,7 @@
GrAA aa = GrAA(paint.isAntiAlias());
if (can_use_draw_texture(paint)) {
draw_texture(paint, viewMatrix, srcRect, dstRect, aa, constraint, std::move(proxy),
- alphaType, colorSpace, this->clip(), fRenderTargetContext.get());
+ colorSpace, this->clip(), fRenderTargetContext.get());
return;
}
GrTextureAdjuster adjuster(this->context(), std::move(proxy), alphaType, pinnedUniqueID,
@@ -174,7 +174,7 @@
return;
}
draw_texture(paint, viewMatrix, srcRect, dstRect, aa, constraint, std::move(proxy),
- maker->alphaType(), cs.get(), this->clip(), fRenderTargetContext.get());
+ cs.get(), this->clip(), fRenderTargetContext.get());
return;
}
this->drawTextureProducer(maker, srcRect, dstRect, constraint, viewMatrix, paint);
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index e4836e9..556373d 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -944,7 +944,7 @@
srcSpace = SkColorSpace::MakeSRGB();
}
- auto xform = GrColorSpaceXformEffect::Make(srcSpace.get(), this->alphaType(), target.get());
+ auto xform = GrColorSpaceXformEffect::Make(srcSpace.get(), target.get());
if (!xform) {
return sk_ref_sp(const_cast<SkImage_Gpu*>(this));
}
diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp
index 28c569f..9619a45 100644
--- a/src/shaders/SkImageShader.cpp
+++ b/src/shaders/SkImageShader.cpp
@@ -242,7 +242,6 @@
inner = GrSimpleTextureEffect::Make(std::move(proxy), lmInverse, samplerState);
}
inner = GrColorSpaceXformEffect::Make(std::move(inner), texColorSpace.get(),
- fImage->alphaType(),
args.fDstColorSpaceInfo->colorSpace());
if (isAlphaOnly) {
return inner;