Reland "Rename GrSimpleTextureEffect->GrTextureEffect"

This reverts commit d7436a37ff.

Restores old file order in gpu.gni until Mac/Metal issue can be
debugged.

Change-Id: I6e2ee3bdc3b39270aeaaf28b9613e4ac49d38e1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262801
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2020-01-07 11:15:44 -05:00 committed by Skia Commit-Bot
parent 3f83bfd21c
commit b8f098d372
27 changed files with 94 additions and 98 deletions

View File

@ -86,7 +86,7 @@ DEF_SIMPLE_GPU_GM_BG(fpcoordinateoverride, ctx, rtCtx, canvas, 512, 512,
GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
sk_sp<GrTextureProxy> texture = proxyProvider->createProxyFromBitmap(bmp, GrMipMapped::kNo);
std::unique_ptr<GrFragmentProcessor> imgFP =
GrSimpleTextureEffect::Make(texture, bmp.alphaType(), SkMatrix());
GrTextureEffect::Make(texture, bmp.alphaType(), SkMatrix());
auto fp = std::unique_ptr<GrFragmentProcessor>(new SampleCoordEffect(std::move(imgFP)));
GrPaint grPaint;

View File

@ -126,8 +126,8 @@ protected:
// filtering
continue;
}
auto fp1 = GrSimpleTextureEffect::Make(proxy, fBitmap.alphaType(),
textureMatrices[tm], fFilter);
auto fp1 = GrTextureEffect::Make(proxy, fBitmap.alphaType(),
textureMatrices[tm], fFilter);
fp1 = GrDomainEffect::Make(
std::move(fp1), GrTextureDomain::MakeTexelDomain(texelDomains[d], mode),
mode, fFilter);

View File

@ -326,8 +326,8 @@ skia_gpu_sources = [
"$_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/GrTextureEffect.cpp",
"$_src/gpu/effects/GrTextureEffect.h",
"$_src/gpu/effects/GrSkSLFP.cpp",
"$_src/gpu/effects/GrSkSLFP.h",
"$_src/gpu/effects/GrSRGBEffect.cpp",

View File

@ -193,9 +193,9 @@ void CCPRGeometryView::onDrawContent(SkCanvas* canvas) {
// Visualize coverage count in main canvas.
GrPaint paint;
paint.addColorFragmentProcessor(
GrSimpleTextureEffect::Make(sk_ref_sp(ccbuff->asTextureProxy()),
ccbuff->colorInfo().alphaType(), SkMatrix::I()));
paint.addColorFragmentProcessor(GrTextureEffect::Make(sk_ref_sp(ccbuff->asTextureProxy()),
ccbuff->colorInfo().alphaType(),
SkMatrix::I()));
paint.addColorFragmentProcessor(
std::make_unique<VisualizeCoverageCountFP>());
paint.setPorterDuffXPFactory(SkBlendMode::kSrcOver);

View File

@ -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 @@ sk_sp<GrTextureProxy> SkBlurMaskFilterImpl::filterMaskGPU(GrRecordingContext* co
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);

View File

@ -320,8 +320,8 @@ static sk_sp<GrTextureProxy> decimate(GrRecordingContext* context,
}
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 @@ static std::unique_ptr<GrRenderTargetContext> reexpand(
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);

View File

@ -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 @@ sk_sp<SkSpecialImage> SkAlphaThresholdFilterImpl::onFilterImage(const Context& c
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(),

View File

@ -354,8 +354,8 @@ sk_sp<SkSpecialImage> ArithmeticImageFilterImpl::filterImageGPU(
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 @@ sk_sp<SkSpecialImage> ArithmeticImageFilterImpl::filterImageGPU(
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),

View File

@ -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 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilterImpl::filterImageGPU(
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 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilterImpl::filterImageGPU(
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),

View File

@ -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 @@ static bool draw_mask(GrRenderTargetContext* renderTargetContext,
-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);

View File

@ -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::setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCovera
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 {

View File

@ -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;

View File

@ -131,7 +131,6 @@ public:
kGrRGBToHSLFilterEffect_ClassID,
kGrRRectBlurEffect_ClassID,
kGrRRectShadowGeoProc_ClassID,
kGrSimpleTextureEffect_ClassID,
kGrSingleIntervalGradientColorizer_ClassID,
kGrSkSLFP_ClassID,
kGrSpecularLightingEffect_ClassID,
@ -139,6 +138,7 @@ public:
kGrSampleMaskProcessor_ClassID,
kGrSaturateProcessor_ClassID,
kGrSweepGradientLayout_ClassID,
kGrTextureEffect_ClassID,
kGrTextureGradientColorizer_ClassID,
kGrTiledGradientEffect_ClassID,
kGrTwoPointConicalGradientLayout_ClassID,

View File

@ -2371,7 +2371,7 @@ bool GrRenderTargetContext::blitTexture(GrTextureProxy* src, const SkIRect& srcR
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;
}

View File

@ -163,7 +163,7 @@ void GrSoftwarePathRenderer::DrawToTargetWithShapeMask(
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);

View File

@ -203,8 +203,8 @@ bool GrSurfaceContext::readPixels(const GrImageInfo& origDstInfo, void* dst, siz
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 @@ bool GrSurfaceContext::readPixels(const GrImageInfo& origDstInfo, void* dst, siz
// 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 @@ bool GrSurfaceContext::writePixels(const GrImageInfo& origSrcInfo, const void* s
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;

View File

@ -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 @@ sk_sp<GrTextureProxy> GrTextureProducer::CopyOnGpu(GrRecordingContext* context,
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 @@ std::unique_ptr<GrFragmentProcessor> GrTextureProducer::createFragmentProcessorF
? 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;

View File

@ -955,8 +955,7 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap,
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 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap,
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 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special, int left, int top, const
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 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special, int left, int top, const
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());
}

View File

@ -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"

View File

@ -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"

View File

@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
#include "src/gpu/effects/GrSimpleTextureEffect.h"
#include "src/gpu/effects/GrTextureEffect.h"
#include "include/gpu/GrTexture.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
@ -14,24 +14,24 @@
#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) {
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::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)));
new GrTextureEffect(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) {
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::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));
new GrTextureEffect(std::move(proxy), alphaType, matrix, sampler));
}
GrGLSLFragmentProcessor* GrSimpleTextureEffect::onCreateGLSLInstance() const {
GrGLSLFragmentProcessor* GrTextureEffect::onCreateGLSLInstance() const {
class Impl : public GrGLSLFragmentProcessor {
public:
void emitCode(EmitArgs& args) override {
@ -51,19 +51,18 @@ GrGLSLFragmentProcessor* GrSimpleTextureEffect::onCreateGLSLInstance() const {
return new Impl;
}
void GrSimpleTextureEffect::onGetGLSLProcessorKey(const GrShaderCaps&,
GrProcessorKeyBuilder*) const {}
void GrTextureEffect::onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const {}
bool GrSimpleTextureEffect::onIsEqual(const GrFragmentProcessor&) const { return true; }
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;
}
GrSimpleTextureEffect::GrSimpleTextureEffect(sk_sp<GrSurfaceProxy> texture, SkAlphaType alphaType,
const SkMatrix& matrix, GrSamplerState sampler)
: GrFragmentProcessor(kGrSimpleTextureEffect_ClassID,
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) {
@ -71,26 +70,25 @@ GrSimpleTextureEffect::GrSimpleTextureEffect(sk_sp<GrSurfaceProxy> texture, SkAl
this->addCoordTransform(&fCoordTransform);
}
GrSimpleTextureEffect::GrSimpleTextureEffect(const GrSimpleTextureEffect& src)
: INHERITED(kGrSimpleTextureEffect_ClassID, src.optimizationFlags())
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> GrSimpleTextureEffect::clone() const {
return std::unique_ptr<GrFragmentProcessor>(new GrSimpleTextureEffect(*this));
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::clone() const {
return std::unique_ptr<GrFragmentProcessor>(new GrTextureEffect(*this));
}
const GrFragmentProcessor::TextureSampler& GrSimpleTextureEffect::onTextureSampler(int) const {
const GrFragmentProcessor::TextureSampler& GrTextureEffect::onTextureSampler(int) const {
return fSampler;
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSimpleTextureEffect);
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureEffect);
#if GR_TEST_UTILS
std::unique_ptr<GrFragmentProcessor> GrSimpleTextureEffect::TestCreate(
GrProcessorTestData* testData) {
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::TestCreate(GrProcessorTestData* testData) {
auto [proxy, ct, at] = testData->randomProxy();
GrSamplerState::WrapMode wrapModes[2];
GrTest::TestWrapModes(testData->fRandom, wrapModes);
@ -106,6 +104,6 @@ std::unique_ptr<GrFragmentProcessor> GrSimpleTextureEffect::TestCreate(
: GrSamplerState::Filter::kNearest);
const SkMatrix& matrix = GrTest::TestMatrix(testData->fRandom);
return GrSimpleTextureEffect::Make(std::move(proxy), at, matrix, params);
return GrTextureEffect::Make(std::move(proxy), at, matrix, params);
}
#endif

View File

@ -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 @@ private:
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;

View File

@ -63,8 +63,8 @@ std::unique_ptr<GrFragmentProcessor> GrYUVtoRGBEffect::Make(const sk_sp<GrTextur
} 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) {

View File

@ -1073,7 +1073,7 @@ std::unique_ptr<GrDrawOp> GrTextureOp::Make(GrRecordingContext* context,
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.

View File

@ -177,7 +177,7 @@ sk_sp<SkShader> SkImageShader::Make(sk_sp<SkImage> image,
#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) {
@ -249,8 +249,7 @@ std::unique_ptr<GrFragmentProcessor> SkImageShader::asFragmentProcessor(
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);

View File

@ -19,7 +19,7 @@
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/effects/GrSimpleTextureEffect.h"
#include "src/gpu/effects/GrTextureEffect.h"
#include "src/gpu/geometry/GrQuad.h"
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
#include "tests/TestUtils.h"
@ -451,7 +451,7 @@ static sk_sp<GrTextureProxy> make_upstream_image(GrContext* context, AtlasObject
for (int i = 0; i < 3; ++i) {
SkRect r = SkRect::MakeXYWH(i*kDrawnTileSize, 0, kDrawnTileSize, kDrawnTileSize);
auto fp = GrSimpleTextureEffect::Make(atlasProxy, atlasAlphaType, SkMatrix::I());
auto fp = GrTextureEffect::Make(atlasProxy, atlasAlphaType, SkMatrix::I());
GrPaint paint;
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
@ -569,7 +569,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) {
SkMatrix t = SkMatrix::MakeTrans(-i*3*kDrawnTileSize, 0);
GrPaint paint;
auto fp = GrSimpleTextureEffect::Make(std::move(proxies[i]), kPremul_SkAlphaType, t);
auto fp = GrTextureEffect::Make(std::move(proxies[i]), kPremul_SkAlphaType, t);
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));

View File

@ -37,7 +37,7 @@ static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* cont
GrSamplerState::Filter::kMipMap}) {
rtContext->clear(nullptr, SkPMColor4f::FromBytes_RGBA(0xDDCCBBAA),
GrRenderTargetContext::CanClearFullscreen::kYes);
auto fp = GrSimpleTextureEffect::Make(rectProxy, alphaType, SkMatrix::I(), filter);
auto fp = GrTextureEffect::Make(rectProxy, alphaType, SkMatrix::I(), filter);
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));