Revert "Rename GrSimpleTextureEffect->GrTextureEffect"
This reverts commit 90673ec66510f70f1d4b0f29d0b9c155aaac3532.
Reason for revert: Causes metal bot failures
Original change's description:
> Rename GrSimpleTextureEffect->GrTextureEffect
>
> It will become less simple.
>
> Change-Id: I409d0faba386597ae05738273d5ff773501eb358
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262383
> Auto-Submit: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=bsalomon@google.com,brianosman@google.com
Change-Id: Id25c9cde3c2048149409745f163e42c588de70c1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262514
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/gm/fpcoordinateoverride.cpp b/gm/fpcoordinateoverride.cpp
index 3cddb4e..3877f40 100644
--- a/gm/fpcoordinateoverride.cpp
+++ b/gm/fpcoordinateoverride.cpp
@@ -86,7 +86,7 @@
GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
sk_sp<GrTextureProxy> texture = proxyProvider->createProxyFromBitmap(bmp, GrMipMapped::kNo);
std::unique_ptr<GrFragmentProcessor> imgFP =
- GrTextureEffect::Make(texture, bmp.alphaType(), SkMatrix());
+ GrSimpleTextureEffect::Make(texture, bmp.alphaType(), SkMatrix());
auto fp = std::unique_ptr<GrFragmentProcessor>(new SampleCoordEffect(std::move(imgFP)));
GrPaint grPaint;
diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp
index 5400492..5049d5c 100644
--- a/gm/texturedomaineffect.cpp
+++ b/gm/texturedomaineffect.cpp
@@ -126,8 +126,8 @@
// filtering
continue;
}
- auto fp1 = GrTextureEffect::Make(proxy, fBitmap.alphaType(),
- textureMatrices[tm], fFilter);
+ auto fp1 = GrSimpleTextureEffect::Make(proxy, fBitmap.alphaType(),
+ textureMatrices[tm], fFilter);
fp1 = GrDomainEffect::Make(
std::move(fp1), GrTextureDomain::MakeTexelDomain(texelDomains[d], mode),
mode, fFilter);
diff --git a/gn/gpu.gni b/gn/gpu.gni
index cf35040..773d0e3 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -326,14 +326,14 @@
"$_src/gpu/effects/GrRRectEffect.h",
"$_src/gpu/effects/GrShadowGeoProc.cpp",
"$_src/gpu/effects/GrShadowGeoProc.h",
+ "$_src/gpu/effects/GrSimpleTextureEffect.cpp",
+ "$_src/gpu/effects/GrSimpleTextureEffect.h",
"$_src/gpu/effects/GrSkSLFP.cpp",
"$_src/gpu/effects/GrSkSLFP.h",
"$_src/gpu/effects/GrSRGBEffect.cpp",
"$_src/gpu/effects/GrSRGBEffect.h",
"$_src/gpu/effects/GrTextureDomain.cpp",
"$_src/gpu/effects/GrTextureDomain.h",
- "$_src/gpu/effects/GrTextureEffect.cpp",
- "$_src/gpu/effects/GrTextureEffect.h",
"$_src/gpu/effects/GrXfermodeFragmentProcessor.cpp",
"$_src/gpu/effects/GrXfermodeFragmentProcessor.h",
"$_src/gpu/effects/GrYUVtoRGBEffect.cpp",
diff --git a/samplecode/SampleCCPRGeometry.cpp b/samplecode/SampleCCPRGeometry.cpp
index b6e270d..fe3b280 100644
--- a/samplecode/SampleCCPRGeometry.cpp
+++ b/samplecode/SampleCCPRGeometry.cpp
@@ -193,9 +193,9 @@
// Visualize coverage count in main canvas.
GrPaint paint;
- paint.addColorFragmentProcessor(GrTextureEffect::Make(sk_ref_sp(ccbuff->asTextureProxy()),
- ccbuff->colorInfo().alphaType(),
- SkMatrix::I()));
+ paint.addColorFragmentProcessor(
+ GrSimpleTextureEffect::Make(sk_ref_sp(ccbuff->asTextureProxy()),
+ ccbuff->colorInfo().alphaType(), SkMatrix::I()));
paint.addColorFragmentProcessor(
std::make_unique<VisualizeCoverageCountFP>());
paint.setPorterDuffXPFactory(SkBlendMode::kSrcOver);
diff --git a/src/core/SkBlurMF.cpp b/src/core/SkBlurMF.cpp
index d9ff65c..43e03fa 100644
--- a/src/core/SkBlurMF.cpp
+++ b/src/core/SkBlurMF.cpp
@@ -28,8 +28,8 @@
#include "src/gpu/GrShaderCaps.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/GrTextureProxy.h"
+#include "src/gpu/effects/GrSimpleTextureEffect.h"
#include "src/gpu/effects/GrTextureDomain.h"
-#include "src/gpu/effects/GrTextureEffect.h"
#include "src/gpu/effects/generated/GrCircleBlurFragmentProcessor.h"
#include "src/gpu/effects/generated/GrRRectBlurEffect.h"
#include "src/gpu/effects/generated/GrRectBlurEffect.h"
@@ -902,7 +902,7 @@
GrPaint paint;
// Blend pathTexture over blurTexture.
paint.addCoverageFragmentProcessor(
- GrTextureEffect::Make(std::move(srcProxy), srcAlphaType, SkMatrix::I()));
+ GrSimpleTextureEffect::Make(std::move(srcProxy), srcAlphaType, SkMatrix::I()));
if (kInner_SkBlurStyle == fBlurStyle) {
// inner: dst = dst * src
paint.setCoverageSetOpXPFactory(SkRegion::kIntersect_Op);
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index e78c2e4..093af54 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -320,8 +320,8 @@
}
GrPaint paint;
- auto fp = GrTextureEffect::Make(std::move(srcProxy), srcAlphaType, SkMatrix::I(),
- GrSamplerState::Filter::kBilerp);
+ auto fp = GrSimpleTextureEffect::Make(std::move(srcProxy), srcAlphaType, SkMatrix::I(),
+ GrSamplerState::Filter::kBilerp);
if (GrTextureDomain::kIgnore_Mode != mode && i == 1) {
// GrDomainEffect does not support kRepeat_Mode with GrSamplerState::Filter.
GrTextureDomain::Mode modeForScaling = (GrTextureDomain::kRepeat_Mode == mode ||
@@ -402,8 +402,8 @@
GrPaint paint;
SkRect domain = GrTextureDomain::MakeTexelDomain(localSrcBounds, GrTextureDomain::kClamp_Mode,
GrTextureDomain::kClamp_Mode);
- auto fp = GrTextureEffect::Make(std::move(srcProxy), srcAlphaType, SkMatrix::I(),
- GrSamplerState::Filter::kBilerp);
+ auto fp = GrSimpleTextureEffect::Make(std::move(srcProxy), srcAlphaType, SkMatrix::I(),
+ GrSamplerState::Filter::kBilerp);
fp = GrDomainEffect::Make(std::move(fp), domain, GrTextureDomain::kClamp_Mode, true);
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
diff --git a/src/effects/imagefilters/SkAlphaThresholdFilter.cpp b/src/effects/imagefilters/SkAlphaThresholdFilter.cpp
index 1367fba..6011002 100644
--- a/src/effects/imagefilters/SkAlphaThresholdFilter.cpp
+++ b/src/effects/imagefilters/SkAlphaThresholdFilter.cpp
@@ -23,7 +23,7 @@
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrTextureProxy.h"
-#include "src/gpu/effects/GrTextureEffect.h"
+#include "src/gpu/effects/GrSimpleTextureEffect.h"
#include "src/gpu/effects/generated/GrAlphaThresholdFragmentProcessor.h"
#endif
@@ -166,7 +166,7 @@
return nullptr;
}
- auto textureFP = GrTextureEffect::Make(
+ auto textureFP = GrSimpleTextureEffect::Make(
std::move(inputProxy), input->alphaType(),
SkMatrix::MakeTrans(input->subset().x(), input->subset().y()));
textureFP = GrColorSpaceXformEffect::Make(std::move(textureFP), input->getColorSpace(),
diff --git a/src/effects/imagefilters/SkArithmeticImageFilter.cpp b/src/effects/imagefilters/SkArithmeticImageFilter.cpp
index 8b5e2d2..6a32c5e 100644
--- a/src/effects/imagefilters/SkArithmeticImageFilter.cpp
+++ b/src/effects/imagefilters/SkArithmeticImageFilter.cpp
@@ -354,8 +354,8 @@
SkMatrix backgroundMatrix = SkMatrix::MakeTrans(
SkIntToScalar(bgSubset.left() - backgroundOffset.fX),
SkIntToScalar(bgSubset.top() - backgroundOffset.fY));
- bgFP = GrTextureEffect::Make(std::move(backgroundProxy), background->alphaType(),
- backgroundMatrix, GrSamplerState::Filter::kNearest);
+ bgFP = GrSimpleTextureEffect::Make(std::move(backgroundProxy), background->alphaType(),
+ backgroundMatrix, GrSamplerState::Filter::kNearest);
bgFP = GrDomainEffect::Make(
std::move(bgFP),
GrTextureDomain::MakeTexelDomain(bgSubset, GrTextureDomain::kDecal_Mode),
@@ -374,8 +374,8 @@
SkIntToScalar(fgSubset.left() - foregroundOffset.fX),
SkIntToScalar(fgSubset.top() - foregroundOffset.fY));
auto foregroundFP =
- GrTextureEffect::Make(std::move(foregroundProxy), foreground->alphaType(),
- foregroundMatrix, GrSamplerState::Filter::kNearest);
+ GrSimpleTextureEffect::Make(std::move(foregroundProxy), foreground->alphaType(),
+ foregroundMatrix, GrSamplerState::Filter::kNearest);
foregroundFP = GrDomainEffect::Make(
std::move(foregroundFP),
GrTextureDomain::MakeTexelDomain(fgSubset, GrTextureDomain::kDecal_Mode),
diff --git a/src/effects/imagefilters/SkXfermodeImageFilter.cpp b/src/effects/imagefilters/SkXfermodeImageFilter.cpp
index c36d226..1a1e2a1 100644
--- a/src/effects/imagefilters/SkXfermodeImageFilter.cpp
+++ b/src/effects/imagefilters/SkXfermodeImageFilter.cpp
@@ -24,8 +24,8 @@
#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
+#include "src/gpu/effects/GrSimpleTextureEffect.h"
#include "src/gpu/effects/GrTextureDomain.h"
-#include "src/gpu/effects/GrTextureEffect.h"
#include "src/gpu/effects/generated/GrConstColorProcessor.h"
#endif
#include "src/core/SkClipOpPriv.h"
@@ -266,8 +266,8 @@
SkMatrix bgMatrix = SkMatrix::MakeTrans(
SkIntToScalar(bgSubset.left() - backgroundOffset.fX),
SkIntToScalar(bgSubset.top() - backgroundOffset.fY));
- bgFP = GrTextureEffect::Make(std::move(backgroundProxy), background->alphaType(), bgMatrix,
- GrSamplerState::Filter::kNearest);
+ bgFP = GrSimpleTextureEffect::Make(std::move(backgroundProxy), background->alphaType(),
+ bgMatrix, GrSamplerState::Filter::kNearest);
bgFP = GrDomainEffect::Make(
std::move(bgFP),
GrTextureDomain::MakeTexelDomain(bgSubset, GrTextureDomain::kDecal_Mode),
@@ -286,8 +286,8 @@
SkIntToScalar(fgSubset.left() - foregroundOffset.fX),
SkIntToScalar(fgSubset.top() - foregroundOffset.fY));
auto foregroundFP =
- GrTextureEffect::Make(std::move(foregroundProxy), foreground->alphaType(), fgMatrix,
- GrSamplerState::Filter::kNearest);
+ GrSimpleTextureEffect::Make(std::move(foregroundProxy), foreground->alphaType(),
+ fgMatrix, GrSamplerState::Filter::kNearest);
foregroundFP = GrDomainEffect::Make(
std::move(foregroundFP),
GrTextureDomain::MakeTexelDomain(fgSubset, GrTextureDomain::kDecal_Mode),
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index f7fae02..1267d2f 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -17,7 +17,7 @@
#include "src/gpu/GrSoftwarePathRenderer.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/GrTextureProxy.h"
-#include "src/gpu/effects/GrTextureEffect.h"
+#include "src/gpu/effects/GrSimpleTextureEffect.h"
#include "src/gpu/geometry/GrShape.h"
#include "include/core/SkPaint.h"
@@ -48,7 +48,7 @@
-SkIntToScalar(maskRect.fTop));
matrix.preConcat(viewMatrix);
paint.addCoverageFragmentProcessor(
- GrTextureEffect::Make(std::move(mask), kUnknown_SkAlphaType, matrix));
+ GrSimpleTextureEffect::Make(std::move(mask), kUnknown_SkAlphaType, matrix));
renderTargetContext->fillRectWithLocalMatrix(clip, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(maskRect), inverse);
diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp
index 0a651ed..3dd8779 100644
--- a/src/gpu/GrPaint.cpp
+++ b/src/gpu/GrPaint.cpp
@@ -9,7 +9,7 @@
#include "src/gpu/GrXferProcessor.h"
#include "src/gpu/effects/GrCoverageSetOpXP.h"
#include "src/gpu/effects/GrPorterDuffXferProcessor.h"
-#include "src/gpu/effects/GrTextureEffect.h"
+#include "src/gpu/effects/GrSimpleTextureEffect.h"
GrPaint::GrPaint(const GrPaint& that)
: fXPFactory(that.fXPFactory)
@@ -38,7 +38,7 @@
void GrPaint::addColorTextureProcessor(sk_sp<GrTextureProxy> proxy, SkAlphaType alphaType,
const SkMatrix& matrix, const GrSamplerState& samplerState) {
this->addColorFragmentProcessor(
- GrTextureEffect::Make(std::move(proxy), alphaType, matrix, samplerState));
+ GrSimpleTextureEffect::Make(std::move(proxy), alphaType, matrix, samplerState));
}
bool GrPaint::isConstantBlendedColor(SkPMColor4f* constantColor) const {
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 7bad0e5..f13264f 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -21,7 +21,7 @@
#include "src/gpu/effects/GrCoverageSetOpXP.h"
#include "src/gpu/effects/GrDisableColorXP.h"
#include "src/gpu/effects/GrPorterDuffXferProcessor.h"
-#include "src/gpu/effects/GrTextureEffect.h"
+#include "src/gpu/effects/GrSimpleTextureEffect.h"
#include "src/gpu/geometry/GrRect.h"
class GrAppliedClip;
diff --git a/src/gpu/GrProcessor.h b/src/gpu/GrProcessor.h
index 3fffc8a..ae1dcf1 100644
--- a/src/gpu/GrProcessor.h
+++ b/src/gpu/GrProcessor.h
@@ -131,6 +131,7 @@
kGrRGBToHSLFilterEffect_ClassID,
kGrRRectBlurEffect_ClassID,
kGrRRectShadowGeoProc_ClassID,
+ kGrSimpleTextureEffect_ClassID,
kGrSingleIntervalGradientColorizer_ClassID,
kGrSkSLFP_ClassID,
kGrSpecularLightingEffect_ClassID,
@@ -138,7 +139,6 @@
kGrSampleMaskProcessor_ClassID,
kGrSaturateProcessor_ClassID,
kGrSweepGradientLayout_ClassID,
- kGrTextureEffect_ClassID,
kGrTextureGradientColorizer_ClassID,
kGrTiledGradientEffect_ClassID,
kGrTwoPointConicalGradientLayout_ClassID,
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 00fb78f..36a82e4 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -2371,7 +2371,7 @@
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- auto fp = GrTextureEffect::Make(sk_ref_sp(src), kUnknown_SkAlphaType, SkMatrix::I());
+ auto fp = GrSimpleTextureEffect::Make(sk_ref_sp(src), kUnknown_SkAlphaType, SkMatrix::I());
if (!fp) {
return false;
}
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index ba75657..26ba0da 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -163,7 +163,7 @@
SkMatrix maskMatrix = SkMatrix::MakeTrans(SkIntToScalar(-textureOriginInDeviceSpace.fX),
SkIntToScalar(-textureOriginInDeviceSpace.fY));
maskMatrix.preConcat(viewMatrix);
- paint.addCoverageFragmentProcessor(GrTextureEffect::Make(
+ paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(
std::move(proxy), kPremul_SkAlphaType, maskMatrix, GrSamplerState::Filter::kNearest));
DrawNonAARect(renderTargetContext, std::move(paint), userStencilSettings, clip, SkMatrix::I(),
dstRect, invert);
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index ca04239..848eee3 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -203,8 +203,8 @@
std::unique_ptr<GrFragmentProcessor> fp;
if (canvas2DFastPath) {
fp = direct->priv().createPMToUPMEffect(
- GrTextureEffect::Make(sk_ref_sp(srcProxy->asTextureProxy()),
- this->colorInfo().alphaType(), SkMatrix::I()));
+ GrSimpleTextureEffect::Make(sk_ref_sp(srcProxy->asTextureProxy()),
+ this->colorInfo().alphaType(), SkMatrix::I()));
if (dstInfo.colorType() == GrColorType::kBGRA_8888) {
fp = GrFragmentProcessor::SwizzleOutput(std::move(fp), GrSwizzle::BGRA());
dstInfo = dstInfo.makeColorType(GrColorType::kRGBA_8888);
@@ -214,8 +214,8 @@
// double unpremul.
dstInfo = dstInfo.makeAlphaType(kPremul_SkAlphaType);
} else {
- fp = GrTextureEffect::Make(sk_ref_sp(srcProxy->asTextureProxy()),
- this->colorInfo().alphaType(), SkMatrix::I());
+ fp = GrSimpleTextureEffect::Make(sk_ref_sp(srcProxy->asTextureProxy()),
+ this->colorInfo().alphaType(), SkMatrix::I());
}
if (!fp) {
return false;
@@ -394,14 +394,14 @@
if (this->asRenderTargetContext()) {
std::unique_ptr<GrFragmentProcessor> fp;
if (canvas2DFastPath) {
- fp = direct->priv().createUPMToPMEffect(
- GrTextureEffect::Make(std::move(tempProxy), alphaType, SkMatrix::I()));
+ fp = direct->priv().createUPMToPMEffect(GrSimpleTextureEffect::Make(
+ std::move(tempProxy), alphaType, SkMatrix::I()));
// Important: check the original src color type here!
if (origSrcInfo.colorType() == GrColorType::kBGRA_8888) {
fp = GrFragmentProcessor::SwizzleOutput(std::move(fp), GrSwizzle::BGRA());
}
} else {
- fp = GrTextureEffect::Make(std::move(tempProxy), alphaType, SkMatrix::I());
+ fp = GrSimpleTextureEffect::Make(std::move(tempProxy), alphaType, SkMatrix::I());
}
if (!fp) {
return false;
diff --git a/src/gpu/GrTextureProducer.cpp b/src/gpu/GrTextureProducer.cpp
index 1bf649d..36e38ea 100644
--- a/src/gpu/GrTextureProducer.cpp
+++ b/src/gpu/GrTextureProducer.cpp
@@ -5,8 +5,6 @@
* found in the LICENSE file.
*/
-#include "src/gpu/GrTextureProducer.h"
-
#include "include/private/GrRecordingContext.h"
#include "src/core/SkMipMap.h"
#include "src/core/SkRectPriv.h"
@@ -15,11 +13,12 @@
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrTextureProducer.h"
#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrBicubicEffect.h"
+#include "src/gpu/effects/GrSimpleTextureEffect.h"
#include "src/gpu/effects/GrTextureDomain.h"
-#include "src/gpu/effects/GrTextureEffect.h"
sk_sp<GrTextureProxy> GrTextureProducer::CopyOnGpu(GrRecordingContext* context,
sk_sp<GrTextureProxy> inputProxy,
@@ -59,8 +58,8 @@
GrPaint paint;
- auto fp = GrTextureEffect::Make(std::move(inputProxy), kUnknown_SkAlphaType, SkMatrix::I(),
- copyParams.fFilter);
+ auto fp = GrSimpleTextureEffect::Make(std::move(inputProxy), kUnknown_SkAlphaType,
+ SkMatrix::I(), copyParams.fFilter);
if (needsDomain) {
const SkRect domain = localRect.makeInset(0.5f, 0.5f);
// This would cause us to read values from outside the subset. Surely, the caller knows
@@ -206,8 +205,8 @@
? GrSamplerState::WrapMode::kClampToBorder
: GrSamplerState::WrapMode::kClamp;
GrSamplerState samplerState(wrapMode, *filterOrNullForBicubic);
- auto fp =
- GrTextureEffect::Make(std::move(proxy), srcAlphaType, textureMatrix, samplerState);
+ auto fp = GrSimpleTextureEffect::Make(std::move(proxy), srcAlphaType, textureMatrix,
+ samplerState);
if (kDomain_DomainMode == domainMode || (fDomainNeedsDecal && !clampToBorderSupport)) {
GrTextureDomain::Mode wrapMode = fDomainNeedsDecal ? GrTextureDomain::kDecal_Mode
: GrTextureDomain::kClamp_Mode;
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 9e114f3..1280b8d 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -955,7 +955,8 @@
static constexpr auto kDir = GrBicubicEffect::Direction::kXY;
fp = GrBicubicEffect::Make(std::move(proxy), texMatrix, domain, kDir, srcAlphaType);
} else {
- fp = GrTextureEffect::Make(std::move(proxy), srcAlphaType, texMatrix, samplerState);
+ fp = GrSimpleTextureEffect::Make(std::move(proxy), srcAlphaType, texMatrix,
+ samplerState);
fp = GrDomainEffect::Make(std::move(fp), domain, GrTextureDomain::kClamp_Mode,
samplerState.filter());
}
@@ -965,7 +966,7 @@
static constexpr auto kDir = GrBicubicEffect::Direction::kXY;
fp = GrBicubicEffect::Make(std::move(proxy), texMatrix, wrapMode, kDir, srcAlphaType);
} else {
- fp = GrTextureEffect::Make(std::move(proxy), srcAlphaType, texMatrix, samplerState);
+ fp = GrSimpleTextureEffect::Make(std::move(proxy), srcAlphaType, texMatrix, samplerState);
}
fp = GrColorSpaceXformEffect::Make(std::move(fp), bitmap.colorSpace(), bitmap.alphaType(),
@@ -1036,7 +1037,7 @@
tmpUnfiltered.setImageFilter(nullptr);
- auto fp = GrTextureEffect::Make(std::move(proxy), special->alphaType(), SkMatrix::I());
+ auto fp = GrSimpleTextureEffect::Make(std::move(proxy), special->alphaType(), SkMatrix::I());
fp = GrColorSpaceXformEffect::Make(std::move(fp), result->getColorSpace(), result->alphaType(),
fRenderTargetContext->colorInfo().colorSpace());
if (GrColorTypeIsAlphaOnly(SkColorTypeToGrColorType(result->colorType()))) {
@@ -1074,8 +1075,8 @@
std::unique_ptr<GrFragmentProcessor> cfp;
if (clipProxy && ctm.invert(&inverseClipMatrix)) {
GrColorType srcColorType = SkColorTypeToGrColorType(clipImage->colorType());
- cfp = GrTextureEffect::Make(std::move(clipProxy), clipImage->alphaType(),
- inverseClipMatrix, sampler);
+ cfp = GrSimpleTextureEffect::Make(std::move(clipProxy), clipImage->alphaType(),
+ inverseClipMatrix, sampler);
if (srcColorType != GrColorType::kAlpha_8) {
cfp = GrFragmentProcessor::SwizzleOutput(std::move(cfp), GrSwizzle::AAAA());
}
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index fc32c27..96a6fd4 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -21,8 +21,8 @@
#include "src/gpu/GrTextureMaker.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrBicubicEffect.h"
+#include "src/gpu/effects/GrSimpleTextureEffect.h"
#include "src/gpu/effects/GrTextureDomain.h"
-#include "src/gpu/effects/GrTextureEffect.h"
#include "src/gpu/geometry/GrShape.h"
#include "src/image/SkImage_Base.h"
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
new file mode 100644
index 0000000..389c8de
--- /dev/null
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/effects/GrSimpleTextureEffect.h"
+
+#include "include/gpu/GrTexture.h"
+#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
+#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
+#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
+#include "src/sksl/SkSLCPP.h"
+#include "src/sksl/SkSLUtil.h"
+
+std::unique_ptr<GrFragmentProcessor> GrSimpleTextureEffect::Make(sk_sp<GrSurfaceProxy> proxy,
+ SkAlphaType alphaType,
+ const SkMatrix& matrix,
+ GrSamplerState::Filter filter) {
+ return std::unique_ptr<GrFragmentProcessor>(
+ new GrSimpleTextureEffect(std::move(proxy), alphaType, matrix,
+ GrSamplerState(GrSamplerState::WrapMode::kClamp, filter)));
+}
+
+std::unique_ptr<GrFragmentProcessor> GrSimpleTextureEffect::Make(sk_sp<GrSurfaceProxy> proxy,
+ SkAlphaType alphaType,
+ const SkMatrix& matrix,
+ GrSamplerState sampler) {
+ return std::unique_ptr<GrFragmentProcessor>(
+ new GrSimpleTextureEffect(std::move(proxy), alphaType, matrix, sampler));
+}
+
+GrGLSLFragmentProcessor* GrSimpleTextureEffect::onCreateGLSLInstance() const {
+ class Impl : public GrGLSLFragmentProcessor {
+ public:
+ void emitCode(EmitArgs& args) override {
+ const char* coords;
+ if (args.fFp.coordTransformsApplyToLocalCoords()) {
+ coords = args.fTransformedCoords[0].fVaryingPoint.c_str();
+ } else {
+ coords = "_coords";
+ }
+ auto* fb = args.fFragBuilder;
+ fb->codeAppendf("%s = ", args.fOutputColor);
+ fb->appendTextureLookupAndBlend(args.fInputColor, SkBlendMode::kModulate,
+ args.fTexSamplers[0], coords);
+ fb->codeAppendf(";");
+ }
+ };
+ return new Impl;
+}
+
+void GrSimpleTextureEffect::onGetGLSLProcessorKey(const GrShaderCaps&,
+ GrProcessorKeyBuilder*) const {}
+
+bool GrSimpleTextureEffect::onIsEqual(const GrFragmentProcessor&) const { return true; }
+
+static inline bool uses_border(const GrSamplerState s) {
+ return s.wrapModeX() == GrSamplerState::WrapMode::kClampToBorder ||
+ s.wrapModeY() == GrSamplerState::WrapMode::kClampToBorder;
+}
+
+GrSimpleTextureEffect::GrSimpleTextureEffect(sk_sp<GrSurfaceProxy> texture, SkAlphaType alphaType,
+ const SkMatrix& matrix, GrSamplerState sampler)
+ : GrFragmentProcessor(kGrSimpleTextureEffect_ClassID,
+ ModulateForSamplerOptFlags(alphaType, uses_border(sampler)))
+ , fCoordTransform(matrix, texture.get())
+ , fSampler(std::move(texture), sampler) {
+ this->setTextureSamplerCnt(1);
+ this->addCoordTransform(&fCoordTransform);
+}
+
+GrSimpleTextureEffect::GrSimpleTextureEffect(const GrSimpleTextureEffect& src)
+ : INHERITED(kGrSimpleTextureEffect_ClassID, src.optimizationFlags())
+ , fCoordTransform(src.fCoordTransform)
+ , fSampler(src.fSampler) {
+ this->setTextureSamplerCnt(1);
+ this->addCoordTransform(&fCoordTransform);
+}
+
+std::unique_ptr<GrFragmentProcessor> GrSimpleTextureEffect::clone() const {
+ return std::unique_ptr<GrFragmentProcessor>(new GrSimpleTextureEffect(*this));
+}
+
+const GrFragmentProcessor::TextureSampler& GrSimpleTextureEffect::onTextureSampler(int) const {
+ return fSampler;
+}
+
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSimpleTextureEffect);
+#if GR_TEST_UTILS
+std::unique_ptr<GrFragmentProcessor> GrSimpleTextureEffect::TestCreate(
+ GrProcessorTestData* testData) {
+ auto [proxy, ct, at] = testData->randomProxy();
+ GrSamplerState::WrapMode wrapModes[2];
+ GrTest::TestWrapModes(testData->fRandom, wrapModes);
+ if (!testData->caps()->npotTextureTileSupport()) {
+ // Performing repeat sampling on npot textures will cause asserts on HW
+ // that lacks support.
+ wrapModes[0] = GrSamplerState::WrapMode::kClamp;
+ wrapModes[1] = GrSamplerState::WrapMode::kClamp;
+ }
+
+ GrSamplerState params(wrapModes, testData->fRandom->nextBool()
+ ? GrSamplerState::Filter::kBilerp
+ : GrSamplerState::Filter::kNearest);
+
+ const SkMatrix& matrix = GrTest::TestMatrix(testData->fRandom);
+ return GrSimpleTextureEffect::Make(std::move(proxy), at, matrix, params);
+}
+#endif
diff --git a/src/gpu/effects/GrTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h
similarity index 82%
rename from src/gpu/effects/GrTextureEffect.h
rename to src/gpu/effects/GrSimpleTextureEffect.h
index 8f1d7ac..f5cb9dc 100644
--- a/src/gpu/effects/GrTextureEffect.h
+++ b/src/gpu/effects/GrSimpleTextureEffect.h
@@ -5,15 +5,15 @@
* found in the LICENSE file.
*/
-#ifndef GrTextureEffect_DEFINED
-#define GrTextureEffect_DEFINED
+#ifndef GrSimpleTextureEffect_DEFINED
+#define GrSimpleTextureEffect_DEFINED
#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"
#include "src/gpu/GrCoordTransform.h"
#include "src/gpu/GrFragmentProcessor.h"
-class GrTextureEffect : public GrFragmentProcessor {
+class GrSimpleTextureEffect : public GrFragmentProcessor {
public:
/** Uses kClamp wrap mode in both dimensions. */
static std::unique_ptr<GrFragmentProcessor> Make(
@@ -36,9 +36,10 @@
GrCoordTransform fCoordTransform;
TextureSampler fSampler;
- GrTextureEffect(const GrTextureEffect& src);
+ GrSimpleTextureEffect(const GrSimpleTextureEffect& src);
- inline GrTextureEffect(sk_sp<GrSurfaceProxy>, SkAlphaType, const SkMatrix&, GrSamplerState);
+ inline GrSimpleTextureEffect(sk_sp<GrSurfaceProxy>, SkAlphaType, const SkMatrix&,
+ GrSamplerState);
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index d26c4bf..dfd606c 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -12,7 +12,7 @@
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrShaderCaps.h"
#include "src/gpu/GrSurfaceProxyPriv.h"
-#include "src/gpu/effects/GrTextureEffect.h"
+#include "src/gpu/effects/GrSimpleTextureEffect.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
diff --git a/src/gpu/effects/GrTextureEffect.cpp b/src/gpu/effects/GrTextureEffect.cpp
deleted file mode 100644
index 0e9f8cf..0000000
--- a/src/gpu/effects/GrTextureEffect.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "src/gpu/effects/GrTextureEffect.h"
-
-#include "include/gpu/GrTexture.h"
-#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
-#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
-#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
-#include "src/sksl/SkSLCPP.h"
-#include "src/sksl/SkSLUtil.h"
-
-std::unique_ptr<GrFragmentProcessor> GrTextureEffect::Make(sk_sp<GrSurfaceProxy> proxy,
- SkAlphaType alphaType,
- const SkMatrix& matrix,
- GrSamplerState::Filter filter) {
- return std::unique_ptr<GrFragmentProcessor>(
- new GrTextureEffect(std::move(proxy), alphaType, matrix,
- GrSamplerState(GrSamplerState::WrapMode::kClamp, filter)));
-}
-
-std::unique_ptr<GrFragmentProcessor> GrTextureEffect::Make(sk_sp<GrSurfaceProxy> proxy,
- SkAlphaType alphaType,
- const SkMatrix& matrix,
- GrSamplerState sampler) {
- return std::unique_ptr<GrFragmentProcessor>(
- new GrTextureEffect(std::move(proxy), alphaType, matrix, sampler));
-}
-
-GrGLSLFragmentProcessor* GrTextureEffect::onCreateGLSLInstance() const {
- class Impl : public GrGLSLFragmentProcessor {
- public:
- void emitCode(EmitArgs& args) override {
- const char* coords;
- if (args.fFp.coordTransformsApplyToLocalCoords()) {
- coords = args.fTransformedCoords[0].fVaryingPoint.c_str();
- } else {
- coords = "_coords";
- }
- auto* fb = args.fFragBuilder;
- fb->codeAppendf("%s = ", args.fOutputColor);
- fb->appendTextureLookupAndBlend(args.fInputColor, SkBlendMode::kModulate,
- args.fTexSamplers[0], coords);
- fb->codeAppendf(";");
- }
- };
- return new Impl;
-}
-
-void GrTextureEffect::onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const {}
-
-bool GrTextureEffect::onIsEqual(const GrFragmentProcessor&) const { return true; }
-
-static inline bool uses_border(const GrSamplerState s) {
- return s.wrapModeX() == GrSamplerState::WrapMode::kClampToBorder ||
- s.wrapModeY() == GrSamplerState::WrapMode::kClampToBorder;
-}
-
-GrTextureEffect::GrTextureEffect(sk_sp<GrSurfaceProxy> texture, SkAlphaType alphaType,
- const SkMatrix& matrix, GrSamplerState sampler)
- : GrFragmentProcessor(kGrTextureEffect_ClassID,
- ModulateForSamplerOptFlags(alphaType, uses_border(sampler)))
- , fCoordTransform(matrix, texture.get())
- , fSampler(std::move(texture), sampler) {
- this->setTextureSamplerCnt(1);
- this->addCoordTransform(&fCoordTransform);
-}
-
-GrTextureEffect::GrTextureEffect(const GrTextureEffect& src)
- : INHERITED(kGrTextureEffect_ClassID, src.optimizationFlags())
- , fCoordTransform(src.fCoordTransform)
- , fSampler(src.fSampler) {
- this->setTextureSamplerCnt(1);
- this->addCoordTransform(&fCoordTransform);
-}
-
-std::unique_ptr<GrFragmentProcessor> GrTextureEffect::clone() const {
- return std::unique_ptr<GrFragmentProcessor>(new GrTextureEffect(*this));
-}
-
-const GrFragmentProcessor::TextureSampler& GrTextureEffect::onTextureSampler(int) const {
- return fSampler;
-}
-
-GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureEffect);
-#if GR_TEST_UTILS
-std::unique_ptr<GrFragmentProcessor> GrTextureEffect::TestCreate(GrProcessorTestData* testData) {
- auto [proxy, ct, at] = testData->randomProxy();
- GrSamplerState::WrapMode wrapModes[2];
- GrTest::TestWrapModes(testData->fRandom, wrapModes);
- if (!testData->caps()->npotTextureTileSupport()) {
- // Performing repeat sampling on npot textures will cause asserts on HW
- // that lacks support.
- wrapModes[0] = GrSamplerState::WrapMode::kClamp;
- wrapModes[1] = GrSamplerState::WrapMode::kClamp;
- }
-
- GrSamplerState params(wrapModes, testData->fRandom->nextBool()
- ? GrSamplerState::Filter::kBilerp
- : GrSamplerState::Filter::kNearest);
-
- const SkMatrix& matrix = GrTest::TestMatrix(testData->fRandom);
- return GrTextureEffect::Make(std::move(proxy), at, matrix, params);
-}
-#endif
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index 987db7e..4d2d732 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -63,8 +63,8 @@
} else if (domain) {
planeDomain = *domain;
}
- planeFPs[i] =
- GrTextureEffect::Make(proxies[i], kUnknown_SkAlphaType, *planeMatrix, planeFilter);
+ planeFPs[i] = GrSimpleTextureEffect::Make(proxies[i], kUnknown_SkAlphaType, *planeMatrix,
+ planeFilter);
if (domain) {
SkASSERT(planeFilter != GrSamplerState::Filter::kMipMap);
if (planeFilter != GrSamplerState::Filter::kNearest) {
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 1425a4f..61ee5a3 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -1073,7 +1073,7 @@
GrSurfaceProxy* proxy = proxyView.proxy();
std::unique_ptr<GrFragmentProcessor> fp;
- fp = GrTextureEffect::Make(sk_ref_sp(proxy), alphaType, SkMatrix::I(), filter);
+ fp = GrSimpleTextureEffect::Make(sk_ref_sp(proxy), alphaType, SkMatrix::I(), filter);
if (domain) {
// Update domain to match what GrTextureOp would do for bilerp, but don't do any
// normalization since GrTextureDomainEffect handles that and the origin.
diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp
index e060cf3..8d2e3ef 100755
--- a/src/shaders/SkImageShader.cpp
+++ b/src/shaders/SkImageShader.cpp
@@ -176,7 +176,7 @@
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrBicubicEffect.h"
-#include "src/gpu/effects/GrTextureEffect.h"
+#include "src/gpu/effects/GrSimpleTextureEffect.h"
static GrSamplerState::WrapMode tile_mode_to_wrap_mode(const SkTileMode tileMode) {
switch (tileMode) {
@@ -248,7 +248,8 @@
kDir, srcAlphaType);
} else {
auto dimensions = proxy->dimensions();
- inner = GrTextureEffect::Make(std::move(proxy), srcAlphaType, lmInverse, samplerState);
+ inner = GrSimpleTextureEffect::Make(std::move(proxy), srcAlphaType, lmInverse,
+ samplerState);
if (domainX != GrTextureDomain::kIgnore_Mode || domainY != GrTextureDomain::kIgnore_Mode) {
SkRect domain = GrTextureDomain::MakeTexelDomain(SkIRect::MakeSize(dimensions),
domainX, domainY);
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index 6480649..ea54ab8 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -19,7 +19,7 @@
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
-#include "src/gpu/effects/GrTextureEffect.h"
+#include "src/gpu/effects/GrSimpleTextureEffect.h"
#include "src/gpu/geometry/GrQuad.h"
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
#include "tests/TestUtils.h"
@@ -451,7 +451,7 @@
for (int i = 0; i < 3; ++i) {
SkRect r = SkRect::MakeXYWH(i*kDrawnTileSize, 0, kDrawnTileSize, kDrawnTileSize);
- auto fp = GrTextureEffect::Make(atlasProxy, atlasAlphaType, SkMatrix::I());
+ auto fp = GrSimpleTextureEffect::Make(atlasProxy, atlasAlphaType, SkMatrix::I());
GrPaint paint;
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
@@ -569,7 +569,7 @@
SkMatrix t = SkMatrix::MakeTrans(-i*3*kDrawnTileSize, 0);
GrPaint paint;
- auto fp = GrTextureEffect::Make(std::move(proxies[i]), kPremul_SkAlphaType, t);
+ auto fp = GrSimpleTextureEffect::Make(std::move(proxies[i]), kPremul_SkAlphaType, t);
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index 7c66850..88ecfb4 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -37,7 +37,7 @@
GrSamplerState::Filter::kMipMap}) {
rtContext->clear(nullptr, SkPMColor4f::FromBytes_RGBA(0xDDCCBBAA),
GrRenderTargetContext::CanClearFullscreen::kYes);
- auto fp = GrTextureEffect::Make(rectProxy, alphaType, SkMatrix::I(), filter);
+ auto fp = GrSimpleTextureEffect::Make(rectProxy, alphaType, SkMatrix::I(), filter);
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));