Rename GrTextureAccess to GrProcessor::TextureSampler.
Renames vars and methods that used the work "access" to refer to this type.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4931
Change-Id: Ibcf488fbd445c5119fc13d190544cd98981bdbee
Reviewed-on: https://skia-review.googlesource.com/4931
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
index 442acd0..9a131f8 100644
--- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp
+++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
@@ -10,7 +10,6 @@
#if SK_SUPPORT_GPU
#include "GrInvariantOutput.h"
-#include "GrTextureAccess.h"
#include "SkRefCnt.h"
#include "glsl/GrGLSLColorSpaceXformHelper.h"
@@ -49,17 +48,17 @@
, fOuterThreshold(outerThreshold)
, fImageCoordTransform(GrCoordTransform::MakeDivByTextureWHMatrix(texture), texture,
GrTextureParams::kNone_FilterMode)
- , fImageTextureAccess(texture)
+ , fImageTextureSampler(texture)
, fColorSpaceXform(std::move(colorSpaceXform))
, fMaskCoordTransform(make_div_and_translate_matrix(maskTexture, -bounds.x(), -bounds.y()),
maskTexture,
GrTextureParams::kNone_FilterMode)
- , fMaskTextureAccess(maskTexture) {
+ , fMaskTextureSampler(maskTexture) {
this->initClassID<GrAlphaThresholdFragmentProcessor>();
this->addCoordTransform(&fImageCoordTransform);
- this->addTextureAccess(&fImageTextureAccess);
+ this->addTextureSampler(&fImageTextureSampler);
this->addCoordTransform(&fMaskCoordTransform);
- this->addTextureAccess(&fMaskTextureAccess);
+ this->addTextureSampler(&fMaskTextureSampler);
}
bool GrAlphaThresholdFragmentProcessor::onIsEqual(const GrFragmentProcessor& sBase) const {
@@ -69,9 +68,10 @@
}
void GrAlphaThresholdFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const {
- if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
+ GrPixelConfig config = this->textureSampler(0).getTexture()->config();
+ if (GrPixelConfigIsAlphaOnly(config)) {
inout->mulByUnknownSingleComponent();
- } else if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThreshold >= 1.f) {
+ } else if (GrPixelConfigIsOpaque(config) && fOuterThreshold >= 1.f) {
inout->mulByUnknownOpaqueFourComponents();
} else {
inout->mulByUnknownFourComponents();
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.h b/src/effects/GrAlphaThresholdFragmentProcessor.h
index c5b8d4e..9805a22 100644
--- a/src/effects/GrAlphaThresholdFragmentProcessor.h
+++ b/src/effects/GrAlphaThresholdFragmentProcessor.h
@@ -55,11 +55,11 @@
float fInnerThreshold;
float fOuterThreshold;
GrCoordTransform fImageCoordTransform;
- GrTextureAccess fImageTextureAccess;
+ TextureSampler fImageTextureSampler;
// Color space transform is for the image (not the mask)
sk_sp<GrColorSpaceXform> fColorSpaceXform;
GrCoordTransform fMaskCoordTransform;
- GrTextureAccess fMaskTextureAccess;
+ TextureSampler fMaskTextureSampler;
typedef GrFragmentProcessor INHERITED;
};
diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp
index d5ed6b7..b8b2660 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.cpp
+++ b/src/effects/GrCircleBlurFragmentProcessor.cpp
@@ -92,9 +92,9 @@
: fCircle(circle)
, fSolidRadius(solidRadius)
, fTextureRadius(textureRadius)
- , fBlurProfileAccess(blurProfile, GrTextureParams::kBilerp_FilterMode) {
+ , fBlurProfileSampler(blurProfile, GrTextureParams::kBilerp_FilterMode) {
this->initClassID<GrCircleBlurFragmentProcessor>();
- this->addTextureAccess(&fBlurProfileAccess);
+ this->addTextureSampler(&fBlurProfileSampler);
this->setWillReadFragmentPosition();
}
diff --git a/src/effects/GrCircleBlurFragmentProcessor.h b/src/effects/GrCircleBlurFragmentProcessor.h
index 6607288..73e5d04 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.h
+++ b/src/effects/GrCircleBlurFragmentProcessor.h
@@ -64,7 +64,7 @@
SkRect fCircle;
SkScalar fSolidRadius;
float fTextureRadius;
- GrTextureAccess fBlurProfileAccess;
+ TextureSampler fBlurProfileSampler;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
diff --git a/src/effects/SkArithmeticMode_gpu.h b/src/effects/SkArithmeticMode_gpu.h
index 4704399..28351fc 100644
--- a/src/effects/SkArithmeticMode_gpu.h
+++ b/src/effects/SkArithmeticMode_gpu.h
@@ -15,7 +15,6 @@
#include "GrCaps.h"
#include "GrCoordTransform.h"
#include "GrFragmentProcessor.h"
-#include "GrTextureAccess.h"
#include "GrTypes.h"
#include "GrXferProcessor.h"
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index 0a98fa8..84cb201 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -825,7 +825,7 @@
SkRect fRect;
float fSigma;
- GrTextureAccess fBlurProfileAccess;
+ TextureSampler fBlurProfileSampler;
GrSLPrecision fPrecision;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
@@ -975,10 +975,10 @@
GrSLPrecision precision)
: fRect(rect)
, fSigma(sigma)
- , fBlurProfileAccess(blurProfile)
+ , fBlurProfileSampler(blurProfile)
, fPrecision(precision) {
this->initClassID<GrRectBlurEffect>();
- this->addTextureAccess(&fBlurProfileAccess);
+ this->addTextureSampler(&fBlurProfileSampler);
this->setWillReadFragmentPosition();
}
@@ -1093,7 +1093,7 @@
SkRRect fRRect;
float fSigma;
- GrTextureAccess fNinePatchAccess;
+ TextureSampler fNinePatchSampler;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
@@ -1205,9 +1205,9 @@
GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTexture *ninePatchTexture)
: fRRect(rrect),
fSigma(sigma),
- fNinePatchAccess(ninePatchTexture) {
+ fNinePatchSampler(ninePatchTexture) {
this->initClassID<GrRRectBlurEffect>();
- this->addTextureAccess(&fNinePatchAccess);
+ this->addTextureSampler(&fNinePatchSampler);
this->setWillReadFragmentPosition();
}
diff --git a/src/effects/SkColorCubeFilter.cpp b/src/effects/SkColorCubeFilter.cpp
index 2c8ab6f..2499155 100644
--- a/src/effects/SkColorCubeFilter.cpp
+++ b/src/effects/SkColorCubeFilter.cpp
@@ -170,7 +170,7 @@
const char* name() const override { return "ColorCube"; }
- int colorCubeSize() const { return fColorCubeAccess.getTexture()->width(); }
+ int colorCubeSize() const { return fColorCubeSampler.getTexture()->width(); }
void onComputeInvariantOutput(GrInvariantOutput*) const override;
@@ -201,7 +201,7 @@
GrColorCubeEffect(GrTexture* colorCube);
- GrTextureAccess fColorCubeAccess;
+ TextureSampler fColorCubeSampler;
typedef GrFragmentProcessor INHERITED;
};
@@ -209,9 +209,9 @@
///////////////////////////////////////////////////////////////////////////////
GrColorCubeEffect::GrColorCubeEffect(GrTexture* colorCube)
- : fColorCubeAccess(colorCube, GrTextureParams::kBilerp_FilterMode) {
+ : fColorCubeSampler(colorCube, GrTextureParams::kBilerp_FilterMode) {
this->initClassID<GrColorCubeEffect>();
- this->addTextureAccess(&fColorCubeAccess);
+ this->addTextureSampler(&fColorCubeSampler);
}
GrColorCubeEffect::~GrColorCubeEffect() {
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 8cb610e..b1f46cd 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -259,10 +259,10 @@
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
GrCoordTransform fDisplacementTransform;
- GrTextureAccess fDisplacementAccess;
+ TextureSampler fDisplacementSampler;
GrCoordTransform fColorTransform;
GrTextureDomain fDomain;
- GrTextureAccess fColorAccess;
+ TextureSampler fColorSampler;
SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector;
SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector;
SkVector fScale;
@@ -486,19 +486,19 @@
GrTexture* color,
const SkISize& colorDimensions)
: fDisplacementTransform(offsetMatrix, displacement, GrTextureParams::kNone_FilterMode)
- , fDisplacementAccess(displacement)
+ , fDisplacementSampler(displacement)
, fColorTransform(color, GrTextureParams::kNone_FilterMode)
, fDomain(GrTextureDomain::MakeTexelDomain(color, SkIRect::MakeSize(colorDimensions)),
GrTextureDomain::kDecal_Mode)
- , fColorAccess(color)
+ , fColorSampler(color)
, fXChannelSelector(xChannelSelector)
, fYChannelSelector(yChannelSelector)
, fScale(scale) {
this->initClassID<GrDisplacementMapEffect>();
this->addCoordTransform(&fDisplacementTransform);
- this->addTextureAccess(&fDisplacementAccess);
+ this->addTextureSampler(&fDisplacementSampler);
this->addCoordTransform(&fColorTransform);
- this->addTextureAccess(&fColorAccess);
+ this->addTextureSampler(&fColorSampler);
}
GrDisplacementMapEffect::~GrDisplacementMapEffect() {
@@ -625,7 +625,7 @@
void GrGLDisplacementMapEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& proc) {
const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMapEffect>();
- GrTexture* colorTex = displacementMap.texture(1);
+ GrTexture* colorTex = displacementMap.textureSampler(1).getTexture();
SkScalar scaleX = displacementMap.scale().fX / colorTex->width();
SkScalar scaleY = displacementMap.scale().fY / colorTex->height();
pdman.set2f(fScaleUni, SkScalarToFloat(scaleX),
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index da6210c..154ebc6 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -1900,7 +1900,7 @@
fLight = lighting.light()->createGLLight();
}
- GrTexture* texture = lighting.texture(0);
+ GrTexture* texture = lighting.textureSampler(0).getTexture();
float ySign = texture->origin() == kTopLeft_GrSurfaceOrigin ? -1.0f : 1.0f;
pdman.set2f(fImageIncrementUni, 1.0f / texture->width(), ySign / texture->height());
pdman.set1f(fSurfaceScaleUni, lighting.surfaceScale());
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index cd35d65..6e581cc 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -294,7 +294,7 @@
void GrGLMorphologyEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& proc) {
const GrMorphologyEffect& m = proc.cast<GrMorphologyEffect>();
- GrTexture& texture = *m.texture(0);
+ GrTexture& texture = *m.textureSampler(0).getTexture();
float pixelSize = 0.0f;
switch (m.direction()) {
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 0b34d16..dc28e44 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -548,12 +548,12 @@
: fType(type)
, fNumOctaves(numOctaves)
, fStitchTiles(stitchTiles)
- , fPermutationsAccess(permutationsTexture)
- , fNoiseAccess(noiseTexture)
+ , fPermutationsSampler(permutationsTexture)
+ , fNoiseSampler(noiseTexture)
, fPaintingData(paintingData) {
this->initClassID<GrPerlinNoiseEffect>();
- this->addTextureAccess(&fPermutationsAccess);
- this->addTextureAccess(&fNoiseAccess);
+ this->addTextureSampler(&fPermutationsSampler);
+ this->addTextureSampler(&fNoiseSampler);
fCoordTransform.reset(matrix);
this->addCoordTransform(&fCoordTransform);
}
@@ -564,8 +564,8 @@
GrCoordTransform fCoordTransform;
int fNumOctaves;
bool fStitchTiles;
- GrTextureAccess fPermutationsAccess;
- GrTextureAccess fNoiseAccess;
+ TextureSampler fPermutationsSampler;
+ TextureSampler fNoiseSampler;
SkPerlinNoiseShader::PaintingData *fPaintingData;
private:
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index cd786df..90a7856 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -365,7 +365,7 @@
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
- GrTextureAccess fTextureAccess;
+ TextureSampler fTextureSampler;
// currently not used in shader code, just to assist onComputeInvariantOutput().
unsigned fFlags;
@@ -485,12 +485,12 @@
ColorTableEffect::ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atlas, int row,
unsigned flags)
- : fTextureAccess(texture)
+ : fTextureSampler(texture)
, fFlags(flags)
, fAtlas(atlas)
, fRow(row) {
this->initClassID<ColorTableEffect>();
- this->addTextureAccess(&fTextureAccess);
+ this->addTextureSampler(&fTextureSampler);
}
ColorTableEffect::~ColorTableEffect() {
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 3bf569c..fcd0bd3 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -1659,7 +1659,7 @@
if (-1 != fRow) {
fYCoord = fAtlas->getYOffset(fRow)+SK_ScalarHalf*fAtlas->getNormalizedTexelHeight();
fCoordTransform.reset(*args.fMatrix, fAtlas->getTexture(), params.filterMode());
- fTextureAccess.reset(fAtlas->getTexture(), params);
+ fTextureSampler.reset(fAtlas->getTexture(), params);
} else {
sk_sp<GrTexture> texture(GrRefCachedBitmapTexture(
args.fContext, bitmap, params,
@@ -1668,11 +1668,11 @@
return;
}
fCoordTransform.reset(*args.fMatrix, texture.get(), params.filterMode());
- fTextureAccess.reset(texture.get(), params);
+ fTextureSampler.reset(texture.get(), params);
fYCoord = SK_ScalarHalf;
}
- this->addTextureAccess(&fTextureAccess);
+ this->addTextureSampler(&fTextureSampler);
break;
}
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 2e447ca..120832f 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -439,7 +439,7 @@
SkShader::TileMode fTileMode;
GrCoordTransform fCoordTransform;
- GrTextureAccess fTextureAccess;
+ TextureSampler fTextureSampler;
SkScalar fYCoord;
GrTextureStripAtlas* fAtlas;
int fRow;