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>
diff --git a/src/core/SkBlurMF.cpp b/src/core/SkBlurMF.cpp
index 43e03fa..d9ff65c 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(
- GrSimpleTextureEffect::Make(std::move(srcProxy), srcAlphaType, SkMatrix::I()));
+ GrTextureEffect::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 093af54..e78c2e4 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -320,8 +320,8 @@
}
GrPaint paint;
- auto fp = GrSimpleTextureEffect::Make(std::move(srcProxy), srcAlphaType, SkMatrix::I(),
- GrSamplerState::Filter::kBilerp);
+ auto fp = GrTextureEffect::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 = GrSimpleTextureEffect::Make(std::move(srcProxy), srcAlphaType, SkMatrix::I(),
- GrSamplerState::Filter::kBilerp);
+ auto fp = GrTextureEffect::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 6011002..1367fba 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/GrSimpleTextureEffect.h"
+#include "src/gpu/effects/GrTextureEffect.h"
#include "src/gpu/effects/generated/GrAlphaThresholdFragmentProcessor.h"
#endif
@@ -166,7 +166,7 @@
return nullptr;
}
- auto textureFP = GrSimpleTextureEffect::Make(
+ auto textureFP = GrTextureEffect::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 6a32c5e..8b5e2d2 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 = GrSimpleTextureEffect::Make(std::move(backgroundProxy), background->alphaType(),
- backgroundMatrix, GrSamplerState::Filter::kNearest);
+ bgFP = GrTextureEffect::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 =
- GrSimpleTextureEffect::Make(std::move(foregroundProxy), foreground->alphaType(),
- foregroundMatrix, GrSamplerState::Filter::kNearest);
+ GrTextureEffect::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 1a1e2a1..c36d226 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 = GrSimpleTextureEffect::Make(std::move(backgroundProxy), background->alphaType(),
- bgMatrix, GrSamplerState::Filter::kNearest);
+ bgFP = GrTextureEffect::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 =
- GrSimpleTextureEffect::Make(std::move(foregroundProxy), foreground->alphaType(),
- fgMatrix, GrSamplerState::Filter::kNearest);
+ GrTextureEffect::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 1267d2f..f7fae02 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/GrSimpleTextureEffect.h"
+#include "src/gpu/effects/GrTextureEffect.h"
#include "src/gpu/geometry/GrShape.h"
#include "include/core/SkPaint.h"
@@ -48,7 +48,7 @@
-SkIntToScalar(maskRect.fTop));
matrix.preConcat(viewMatrix);
paint.addCoverageFragmentProcessor(
- GrSimpleTextureEffect::Make(std::move(mask), kUnknown_SkAlphaType, matrix));
+ GrTextureEffect::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 3dd8779..0a651ed 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/GrSimpleTextureEffect.h"
+#include "src/gpu/effects/GrTextureEffect.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(
- GrSimpleTextureEffect::Make(std::move(proxy), alphaType, matrix, samplerState));
+ GrTextureEffect::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 f13264f..7bad0e5 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/GrSimpleTextureEffect.h"
+#include "src/gpu/effects/GrTextureEffect.h"
#include "src/gpu/geometry/GrRect.h"
class GrAppliedClip;
diff --git a/src/gpu/GrProcessor.h b/src/gpu/GrProcessor.h
index ae1dcf1..3fffc8a 100644
--- a/src/gpu/GrProcessor.h
+++ b/src/gpu/GrProcessor.h
@@ -131,7 +131,6 @@
kGrRGBToHSLFilterEffect_ClassID,
kGrRRectBlurEffect_ClassID,
kGrRRectShadowGeoProc_ClassID,
- kGrSimpleTextureEffect_ClassID,
kGrSingleIntervalGradientColorizer_ClassID,
kGrSkSLFP_ClassID,
kGrSpecularLightingEffect_ClassID,
@@ -139,6 +138,7 @@
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 36a82e4..00fb78f 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -2371,7 +2371,7 @@
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- auto fp = GrSimpleTextureEffect::Make(sk_ref_sp(src), kUnknown_SkAlphaType, SkMatrix::I());
+ auto fp = GrTextureEffect::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 26ba0da..ba75657 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(GrSimpleTextureEffect::Make(
+ paint.addCoverageFragmentProcessor(GrTextureEffect::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 848eee3..ca04239 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(
- GrSimpleTextureEffect::Make(sk_ref_sp(srcProxy->asTextureProxy()),
- this->colorInfo().alphaType(), SkMatrix::I()));
+ GrTextureEffect::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 = GrSimpleTextureEffect::Make(sk_ref_sp(srcProxy->asTextureProxy()),
- this->colorInfo().alphaType(), SkMatrix::I());
+ fp = GrTextureEffect::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(GrSimpleTextureEffect::Make(
- std::move(tempProxy), alphaType, SkMatrix::I()));
+ fp = direct->priv().createUPMToPMEffect(
+ GrTextureEffect::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 = GrSimpleTextureEffect::Make(std::move(tempProxy), alphaType, SkMatrix::I());
+ fp = GrTextureEffect::Make(std::move(tempProxy), alphaType, SkMatrix::I());
}
if (!fp) {
return false;
diff --git a/src/gpu/GrTextureProducer.cpp b/src/gpu/GrTextureProducer.cpp
index 36e38ea..1bf649d 100644
--- a/src/gpu/GrTextureProducer.cpp
+++ b/src/gpu/GrTextureProducer.cpp
@@ -5,6 +5,8 @@
* 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"
@@ -13,12 +15,11 @@
#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,
@@ -58,8 +59,8 @@
GrPaint paint;
- auto fp = GrSimpleTextureEffect::Make(std::move(inputProxy), kUnknown_SkAlphaType,
- SkMatrix::I(), copyParams.fFilter);
+ auto fp = GrTextureEffect::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
@@ -205,8 +206,8 @@
? GrSamplerState::WrapMode::kClampToBorder
: GrSamplerState::WrapMode::kClamp;
GrSamplerState samplerState(wrapMode, *filterOrNullForBicubic);
- auto fp = GrSimpleTextureEffect::Make(std::move(proxy), srcAlphaType, textureMatrix,
- samplerState);
+ auto fp =
+ GrTextureEffect::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 1280b8d..9e114f3 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -955,8 +955,7 @@
static constexpr auto kDir = GrBicubicEffect::Direction::kXY;
fp = GrBicubicEffect::Make(std::move(proxy), texMatrix, domain, kDir, srcAlphaType);
} else {
- fp = GrSimpleTextureEffect::Make(std::move(proxy), srcAlphaType, texMatrix,
- samplerState);
+ fp = GrTextureEffect::Make(std::move(proxy), srcAlphaType, texMatrix, samplerState);
fp = GrDomainEffect::Make(std::move(fp), domain, GrTextureDomain::kClamp_Mode,
samplerState.filter());
}
@@ -966,7 +965,7 @@
static constexpr auto kDir = GrBicubicEffect::Direction::kXY;
fp = GrBicubicEffect::Make(std::move(proxy), texMatrix, wrapMode, kDir, srcAlphaType);
} else {
- fp = GrSimpleTextureEffect::Make(std::move(proxy), srcAlphaType, texMatrix, samplerState);
+ fp = GrTextureEffect::Make(std::move(proxy), srcAlphaType, texMatrix, samplerState);
}
fp = GrColorSpaceXformEffect::Make(std::move(fp), bitmap.colorSpace(), bitmap.alphaType(),
@@ -1037,7 +1036,7 @@
tmpUnfiltered.setImageFilter(nullptr);
- auto fp = GrSimpleTextureEffect::Make(std::move(proxy), special->alphaType(), SkMatrix::I());
+ auto fp = GrTextureEffect::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()))) {
@@ -1075,8 +1074,8 @@
std::unique_ptr<GrFragmentProcessor> cfp;
if (clipProxy && ctm.invert(&inverseClipMatrix)) {
GrColorType srcColorType = SkColorTypeToGrColorType(clipImage->colorType());
- cfp = GrSimpleTextureEffect::Make(std::move(clipProxy), clipImage->alphaType(),
- inverseClipMatrix, sampler);
+ cfp = GrTextureEffect::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 96a6fd4..fc32c27 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
deleted file mode 100644
index 389c8de..0000000
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ /dev/null
@@ -1,111 +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/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/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index dfd606c..d26c4bf 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/GrSimpleTextureEffect.h"
+#include "src/gpu/effects/GrTextureEffect.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
new file mode 100644
index 0000000..0e9f8cf
--- /dev/null
+++ b/src/gpu/effects/GrTextureEffect.cpp
@@ -0,0 +1,109 @@
+/*
+ * 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/GrSimpleTextureEffect.h b/src/gpu/effects/GrTextureEffect.h
similarity index 82%
rename from src/gpu/effects/GrSimpleTextureEffect.h
rename to src/gpu/effects/GrTextureEffect.h
index f5cb9dc..8f1d7ac 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.h
+++ b/src/gpu/effects/GrTextureEffect.h
@@ -5,15 +5,15 @@
* found in the LICENSE file.
*/
-#ifndef GrSimpleTextureEffect_DEFINED
-#define GrSimpleTextureEffect_DEFINED
+#ifndef GrTextureEffect_DEFINED
+#define GrTextureEffect_DEFINED
#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"
#include "src/gpu/GrCoordTransform.h"
#include "src/gpu/GrFragmentProcessor.h"
-class GrSimpleTextureEffect : public GrFragmentProcessor {
+class GrTextureEffect : public GrFragmentProcessor {
public:
/** Uses kClamp wrap mode in both dimensions. */
static std::unique_ptr<GrFragmentProcessor> Make(
@@ -36,10 +36,9 @@
GrCoordTransform fCoordTransform;
TextureSampler fSampler;
- GrSimpleTextureEffect(const GrSimpleTextureEffect& src);
+ GrTextureEffect(const GrTextureEffect& src);
- inline GrSimpleTextureEffect(sk_sp<GrSurfaceProxy>, SkAlphaType, const SkMatrix&,
- GrSamplerState);
+ inline GrTextureEffect(sk_sp<GrSurfaceProxy>, SkAlphaType, const SkMatrix&, GrSamplerState);
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index 4d2d732..987db7e 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -63,8 +63,8 @@
} else if (domain) {
planeDomain = *domain;
}
- planeFPs[i] = GrSimpleTextureEffect::Make(proxies[i], kUnknown_SkAlphaType, *planeMatrix,
- planeFilter);
+ planeFPs[i] =
+ GrTextureEffect::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 61ee5a3..1425a4f 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 = GrSimpleTextureEffect::Make(sk_ref_sp(proxy), alphaType, SkMatrix::I(), filter);
+ fp = GrTextureEffect::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 67ae3f8..90c829d 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/GrSimpleTextureEffect.h"
+#include "src/gpu/effects/GrTextureEffect.h"
static GrSamplerState::WrapMode tile_mode_to_wrap_mode(const SkTileMode tileMode) {
switch (tileMode) {
@@ -248,8 +248,7 @@
kDir, srcAlphaType);
} else {
auto dimensions = proxy->dimensions();
- inner = GrSimpleTextureEffect::Make(std::move(proxy), srcAlphaType, lmInverse,
- samplerState);
+ inner = GrTextureEffect::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);