aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-02-21 10:04:31 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-21 16:34:11 +0000
commitdbc8eeb592123619d9c5bb4b6c6225b9fd45d03b (patch)
tree053905e92d6e9ac236a2a2adecb07104e9c0e390 /src/gpu/effects
parent9048851e579dffad43f0c77e15030d4fdd5377a8 (diff)
Remove GrProcessorTestData's GrTextures
(No longer) Blocked on: https://skia-review.googlesource.com/c/8450/ (Remove asTextureRef from SkSpecialImage & update effects accordingly (take 2)) This also (unfortunately) picks up a few straggling effects that didn't have a sk_sp<GrTextureProxy> factory. Change-Id: I5ce583a084aa8fe00e866eec1db90e2ec9dd2ab0 Reviewed-on: https://skia-review.googlesource.com/8500 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/GrBezierEffect.cpp6
-rw-r--r--src/gpu/effects/GrBitmapTextGeoProc.cpp31
-rw-r--r--src/gpu/effects/GrBitmapTextGeoProc.h12
-rw-r--r--src/gpu/effects/GrDistanceFieldGeoProc.cpp102
-rw-r--r--src/gpu/effects/GrDistanceFieldGeoProc.h61
-rw-r--r--src/gpu/effects/GrMatrixConvolutionEffect.cpp16
6 files changed, 206 insertions, 22 deletions
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 4877072210..6c01f70028 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -266,7 +266,7 @@ sk_sp<GrGeometryProcessor> GrConicEffect::TestCreate(GrProcessorTestData* d) {
static_cast<GrPrimitiveEdgeType>(
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
gp = GrConicEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom),
- edgeType, *d->fContext->caps(), GrTest::TestMatrix(d->fRandom),
+ edgeType, *d->context()->caps(), GrTest::TestMatrix(d->fRandom),
d->fRandom->nextBool());
} while (nullptr == gp);
return gp;
@@ -468,7 +468,7 @@ sk_sp<GrGeometryProcessor> GrQuadEffect::TestCreate(GrProcessorTestData* d) {
GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
gp = GrQuadEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom), edgeType,
- *d->fContext->caps(), GrTest::TestMatrix(d->fRandom),
+ *d->context()->caps(), GrTest::TestMatrix(d->fRandom),
d->fRandom->nextBool());
} while (nullptr == gp);
return gp;
@@ -691,7 +691,7 @@ sk_sp<GrGeometryProcessor> GrCubicEffect::TestCreate(GrProcessorTestData* d) {
static_cast<GrPrimitiveEdgeType>(
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
gp = GrCubicEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom),
- edgeType, *d->fContext->caps());
+ edgeType, *d->context()->caps());
} while (nullptr == gp);
return gp;
}
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index cb9cfdcc84..b1aa1d4723 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -6,6 +6,8 @@
*/
#include "GrBitmapTextGeoProc.h"
+
+#include "GrContext.h"
#include "GrTexture.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLGeometryProcessor.h"
@@ -140,6 +142,29 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture,
this->addTextureSampler(&fTextureSampler);
}
+GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrContext* context, GrColor color,
+ sk_sp<GrTextureProxy> proxy,
+ const GrSamplerParams& params, GrMaskFormat format,
+ const SkMatrix& localMatrix, bool usesLocalCoords)
+ : fColor(color)
+ , fLocalMatrix(localMatrix)
+ , fUsesLocalCoords(usesLocalCoords)
+ , fTextureSampler(context->textureProvider(), std::move(proxy), params)
+ , fInColor(nullptr)
+ , fMaskFormat(format) {
+ this->initClassID<GrBitmapTextGeoProc>();
+ fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType);
+
+ bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat ||
+ kA565_GrMaskFormat == fMaskFormat;
+ if (hasVertexColor) {
+ fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+ }
+ fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_GrVertexAttribType,
+ kHigh_GrSLPrecision);
+ this->addTextureSampler(&fTextureSampler);
+}
+
void GrBitmapTextGeoProc::getGLSLProcessorKey(const GrShaderCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLBitmapTextGeoProc::GenKey(*this, caps, b);
@@ -157,6 +182,8 @@ GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrBitmapTextGeoProc);
sk_sp<GrGeometryProcessor> GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* d) {
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
: GrProcessorUnitTest::kAlphaTextureIdx;
+ sk_sp<GrTextureProxy> proxy = d->textureProxy(texIdx);
+
static const SkShader::TileMode kTileModes[] = {
SkShader::kClamp_TileMode,
SkShader::kRepeat_TileMode,
@@ -182,8 +209,8 @@ sk_sp<GrGeometryProcessor> GrBitmapTextGeoProc::TestCreate(GrProcessorTestData*
break;
}
- return GrBitmapTextGeoProc::Make(GrRandomColor(d->fRandom), d->fTextures[texIdx], params,
- format, GrTest::TestMatrix(d->fRandom),
+ return GrBitmapTextGeoProc::Make(d->context(), GrRandomColor(d->fRandom), std::move(proxy),
+ params, format, GrTest::TestMatrix(d->fRandom),
d->fRandom->nextBool());
}
#endif
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.h b/src/gpu/effects/GrBitmapTextGeoProc.h
index f15de47cf4..0f30ddc0a0 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.h
+++ b/src/gpu/effects/GrBitmapTextGeoProc.h
@@ -28,6 +28,15 @@ public:
new GrBitmapTextGeoProc(color, tex, p, format, localMatrix, usesLocalCoords));
}
+ static sk_sp<GrGeometryProcessor> Make(GrContext* context, GrColor color,
+ sk_sp<GrTextureProxy> proxy, const GrSamplerParams& p,
+ GrMaskFormat format, const SkMatrix& localMatrix,
+ bool usesLocalCoords) {
+ return sk_sp<GrGeometryProcessor>(
+ new GrBitmapTextGeoProc(context, color, std::move(proxy), p, format,
+ localMatrix, usesLocalCoords));
+ }
+
virtual ~GrBitmapTextGeoProc() {}
const char* name() const override { return "Texture"; }
@@ -49,6 +58,9 @@ private:
GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrSamplerParams& params,
GrMaskFormat format, const SkMatrix& localMatrix, bool usesLocalCoords);
+ GrBitmapTextGeoProc(GrContext*, GrColor, sk_sp<GrTextureProxy>, const GrSamplerParams& params,
+ GrMaskFormat format, const SkMatrix& localMatrix, bool usesLocalCoords);
+
GrColor fColor;
SkMatrix fLocalMatrix;
bool fUsesLocalCoords;
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 9a7e787577..89ec238efd 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -6,6 +6,8 @@
*/
#include "GrDistanceFieldGeoProc.h"
+
+#include "GrContext.h"
#include "GrTexture.h"
#include "SkDistanceFieldGen.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
@@ -248,6 +250,35 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color,
this->addTextureSampler(&fTextureSampler);
}
+GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrContext* context,
+ GrColor color,
+ const SkMatrix& viewMatrix,
+ sk_sp<GrTextureProxy> proxy,
+ const GrSamplerParams& params,
+#ifdef SK_GAMMA_APPLY_TO_A8
+ float distanceAdjust,
+#endif
+ uint32_t flags,
+ bool usesLocalCoords)
+ : fColor(color)
+ , fViewMatrix(viewMatrix)
+ , fTextureSampler(context->textureProvider(), std::move(proxy), params)
+#ifdef SK_GAMMA_APPLY_TO_A8
+ , fDistanceAdjust(distanceAdjust)
+#endif
+ , fFlags(flags & kNonLCD_DistanceFieldEffectMask)
+ , fInColor(nullptr)
+ , fUsesLocalCoords(usesLocalCoords) {
+ SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
+ this->initClassID<GrDistanceFieldA8TextGeoProc>();
+ fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+ kHigh_GrSLPrecision);
+ fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+ fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_GrVertexAttribType,
+ kHigh_GrSLPrecision);
+ this->addTextureSampler(&fTextureSampler);
+}
+
void GrDistanceFieldA8TextGeoProc::getGLSLProcessorKey(const GrShaderCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLDistanceFieldA8TextGeoProc::GenKey(*this, caps, b);
@@ -264,8 +295,10 @@ GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldA8TextGeoProc);
#if GR_TEST_UTILS
sk_sp<GrGeometryProcessor> GrDistanceFieldA8TextGeoProc::TestCreate(GrProcessorTestData* d) {
- int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
- GrProcessorUnitTest::kAlphaTextureIdx;
+ int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
+ : GrProcessorUnitTest::kAlphaTextureIdx;
+ sk_sp<GrTextureProxy> proxy = d->textureProxy(texIdx);
+
static const SkShader::TileMode kTileModes[] = {
SkShader::kClamp_TileMode,
SkShader::kRepeat_TileMode,
@@ -284,9 +317,10 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldA8TextGeoProc::TestCreate(GrProcessorT
flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0;
}
- return GrDistanceFieldA8TextGeoProc::Make(GrRandomColor(d->fRandom),
+ return GrDistanceFieldA8TextGeoProc::Make(d->context(),
+ GrRandomColor(d->fRandom),
GrTest::TestMatrix(d->fRandom),
- d->fTextures[texIdx], params,
+ std::move(proxy), params,
#ifdef SK_GAMMA_APPLY_TO_A8
d->fRandom->nextF(),
#endif
@@ -488,6 +522,30 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
this->addTextureSampler(&fTextureSampler);
}
+
+GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
+ GrContext* context,
+ GrColor color,
+ const SkMatrix& viewMatrix,
+ sk_sp<GrTextureProxy> proxy,
+ const GrSamplerParams& params,
+ uint32_t flags,
+ bool usesLocalCoords)
+ : fColor(color)
+ , fViewMatrix(viewMatrix)
+ , fTextureSampler(context->textureProvider(), std::move(proxy), params)
+ , fFlags(flags & kNonLCD_DistanceFieldEffectMask)
+ , fInColor(nullptr)
+ , fUsesLocalCoords(usesLocalCoords) {
+ SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
+ this->initClassID<GrDistanceFieldPathGeoProc>();
+ fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+ kHigh_GrSLPrecision);
+ fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+ fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2f_GrVertexAttribType);
+ this->addTextureSampler(&fTextureSampler);
+}
+
void GrDistanceFieldPathGeoProc::getGLSLProcessorKey(const GrShaderCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLDistanceFieldPathGeoProc::GenKey(*this, caps, b);
@@ -506,6 +564,8 @@ GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldPathGeoProc);
sk_sp<GrGeometryProcessor> GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTestData* d) {
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
: GrProcessorUnitTest::kAlphaTextureIdx;
+ sk_sp<GrTextureProxy> proxy = d->textureProxy(texIdx);
+
static const SkShader::TileMode kTileModes[] = {
SkShader::kClamp_TileMode,
SkShader::kRepeat_TileMode,
@@ -524,9 +584,10 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTes
flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0;
}
- return GrDistanceFieldPathGeoProc::Make(GrRandomColor(d->fRandom),
+ return GrDistanceFieldPathGeoProc::Make(d->context(),
+ GrRandomColor(d->fRandom),
GrTest::TestMatrix(d->fRandom),
- d->fTextures[texIdx],
+ std::move(proxy),
params,
flags,
d->fRandom->nextBool());
@@ -789,6 +850,29 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
this->addTextureSampler(&fTextureSampler);
}
+GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
+ GrContext* context,
+ GrColor color, const SkMatrix& viewMatrix,
+ sk_sp<GrTextureProxy> proxy,
+ const GrSamplerParams& params,
+ DistanceAdjust distanceAdjust,
+ uint32_t flags, bool usesLocalCoords)
+ : fColor(color)
+ , fViewMatrix(viewMatrix)
+ , fTextureSampler(context->textureProvider(), std::move(proxy), params)
+ , fDistanceAdjust(distanceAdjust)
+ , fFlags(flags & kLCD_DistanceFieldEffectMask)
+ , fUsesLocalCoords(usesLocalCoords) {
+ SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_DistanceFieldEffectFlag));
+ this->initClassID<GrDistanceFieldLCDTextGeoProc>();
+ fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+ kHigh_GrSLPrecision);
+ fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+ fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_GrVertexAttribType,
+ kHigh_GrSLPrecision);
+ this->addTextureSampler(&fTextureSampler);
+}
+
void GrDistanceFieldLCDTextGeoProc::getGLSLProcessorKey(const GrShaderCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLDistanceFieldLCDTextGeoProc::GenKey(*this, caps, b);
@@ -806,6 +890,8 @@ GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldLCDTextGeoProc);
sk_sp<GrGeometryProcessor> GrDistanceFieldLCDTextGeoProc::TestCreate(GrProcessorTestData* d) {
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
+ sk_sp<GrTextureProxy> proxy = d->textureProxy(texIdx);
+
static const SkShader::TileMode kTileModes[] = {
SkShader::kClamp_TileMode,
SkShader::kRepeat_TileMode,
@@ -824,9 +910,9 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldLCDTextGeoProc::TestCreate(GrProcessor
flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0;
}
flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0;
- return GrDistanceFieldLCDTextGeoProc::Make(GrRandomColor(d->fRandom),
+ return GrDistanceFieldLCDTextGeoProc::Make(d->context(), GrRandomColor(d->fRandom),
GrTest::TestMatrix(d->fRandom),
- d->fTextures[texIdx], params,
+ std::move(proxy), params,
wa,
flags,
d->fRandom->nextBool());
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.h b/src/gpu/effects/GrDistanceFieldGeoProc.h
index 4355e8dd20..1852c13984 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.h
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.h
@@ -56,6 +56,16 @@ public:
new GrDistanceFieldA8TextGeoProc(color, viewMatrix, tex, params, lum, flags,
usesLocalCoords));
}
+
+ static sk_sp<GrGeometryProcessor> Make(GrContext* context,
+ GrColor color, const SkMatrix& viewMatrix,
+ sk_sp<GrTextureProxy> proxy,
+ const GrSamplerParams& params,
+ float lum, uint32_t flags, bool usesLocalCoords) {
+ return sk_sp<GrGeometryProcessor>(
+ new GrDistanceFieldA8TextGeoProc(context, color, viewMatrix, std::move(proxy),
+ params, lum, flags, usesLocalCoords));
+ }
#else
static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix,
GrTexture* tex, const GrSamplerParams& params,
@@ -64,6 +74,16 @@ public:
new GrDistanceFieldA8TextGeoProc(color, viewMatrix, tex, params, flags,
usesLocalCoords));
}
+
+ static sk_sp<GrGeometryProcessor> Make(GrContext* context,
+ GrColor color, const SkMatrix& viewMatrix,
+ sk_sp<GrTextureProxy> proxy,
+ const GrSamplerParams& params,
+ uint32_t flags, bool usesLocalCoords) {
+ return sk_sp<GrGeometryProcessor>(
+ new GrDistanceFieldA8TextGeoProc(context, color, viewMatrix, std::move(proxy),
+ params, flags, usesLocalCoords));
+ }
#endif
virtual ~GrDistanceFieldA8TextGeoProc() {}
@@ -93,6 +113,13 @@ private:
#endif
uint32_t flags, bool usesLocalCoords);
+ GrDistanceFieldA8TextGeoProc(GrContext*, GrColor, const SkMatrix& viewMatrix,
+ sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params,
+#ifdef SK_GAMMA_APPLY_TO_A8
+ float distanceAdjust,
+#endif
+ uint32_t flags, bool usesLocalCoords);
+
GrColor fColor;
SkMatrix fViewMatrix;
TextureSampler fTextureSampler;
@@ -126,7 +153,16 @@ public:
new GrDistanceFieldPathGeoProc(color, viewMatrix, tex, params, flags, usesLocalCoords));
}
- virtual ~GrDistanceFieldPathGeoProc() {}
+ static sk_sp<GrGeometryProcessor> Make(GrContext* context, GrColor color,
+ const SkMatrix& viewMatrix, sk_sp<GrTextureProxy> proxy,
+ const GrSamplerParams& params,
+ uint32_t flags, bool usesLocalCoords) {
+ return sk_sp<GrGeometryProcessor>(
+ new GrDistanceFieldPathGeoProc(context, color, viewMatrix, std::move(proxy),
+ params, flags, usesLocalCoords));
+ }
+
+ ~GrDistanceFieldPathGeoProc() override {}
const char* name() const override { return "DistanceFieldPath"; }
@@ -147,6 +183,10 @@ private:
const GrSamplerParams& params, uint32_t flags,
bool usesLocalCoords);
+ GrDistanceFieldPathGeoProc(GrContext*, GrColor, const SkMatrix& viewMatrix,
+ sk_sp<GrTextureProxy>, const GrSamplerParams&, uint32_t flags,
+ bool usesLocalCoords);
+
GrColor fColor;
SkMatrix fViewMatrix;
TextureSampler fTextureSampler;
@@ -193,7 +233,19 @@ public:
flags, usesLocalCoords));
}
- virtual ~GrDistanceFieldLCDTextGeoProc() {}
+ static sk_sp<GrGeometryProcessor> Make(GrContext* context, GrColor color,
+ const SkMatrix& viewMatrix,
+ sk_sp<GrTextureProxy> proxy,
+ const GrSamplerParams& params,
+ DistanceAdjust distanceAdjust, uint32_t flags,
+ bool usesLocalCoords) {
+ return sk_sp<GrGeometryProcessor>(
+ new GrDistanceFieldLCDTextGeoProc(context, color, viewMatrix, std::move(proxy),
+ params, distanceAdjust,
+ flags, usesLocalCoords));
+ }
+
+ ~GrDistanceFieldLCDTextGeoProc() override {}
const char* name() const override { return "DistanceFieldLCDText"; }
@@ -216,6 +268,11 @@ private:
DistanceAdjust wa, uint32_t flags,
bool usesLocalCoords);
+ GrDistanceFieldLCDTextGeoProc(GrContext*, GrColor, const SkMatrix& viewMatrix,
+ sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params,
+ DistanceAdjust wa, uint32_t flags,
+ bool usesLocalCoords);
+
GrColor fColor;
SkMatrix fViewMatrix;
TextureSampler fTextureSampler;
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 0cae0bab0a..fd90c72800 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -294,8 +294,10 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMatrixConvolutionEffect);
#if GR_TEST_UTILS
sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::TestCreate(GrProcessorTestData* d) {
- int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
- GrProcessorUnitTest::kAlphaTextureIdx;
+ int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
+ : GrProcessorUnitTest::kAlphaTextureIdx;
+ sk_sp<GrTextureProxy> proxy = d->textureProxy(texIdx);
+
int width = d->fRandom->nextRangeU(1, MAX_KERNEL_SIZE);
int height = d->fRandom->nextRangeU(1, MAX_KERNEL_SIZE / width);
SkISize kernelSize = SkISize::Make(width, height);
@@ -307,15 +309,15 @@ sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::TestCreate(GrProcessorTest
SkScalar bias = d->fRandom->nextSScalar1();
SkIPoint kernelOffset = SkIPoint::Make(d->fRandom->nextRangeU(0, kernelSize.width()),
d->fRandom->nextRangeU(0, kernelSize.height()));
- SkIRect bounds = SkIRect::MakeXYWH(d->fRandom->nextRangeU(0, d->fTextures[texIdx]->width()),
- d->fRandom->nextRangeU(0, d->fTextures[texIdx]->height()),
- d->fRandom->nextRangeU(0, d->fTextures[texIdx]->width()),
- d->fRandom->nextRangeU(0, d->fTextures[texIdx]->height()));
+ SkIRect bounds = SkIRect::MakeXYWH(d->fRandom->nextRangeU(0, proxy->width()),
+ d->fRandom->nextRangeU(0, proxy->height()),
+ d->fRandom->nextRangeU(0, proxy->width()),
+ d->fRandom->nextRangeU(0, proxy->height()));
GrTextureDomain::Mode tileMode =
static_cast<GrTextureDomain::Mode>(d->fRandom->nextRangeU(0, 2));
bool convolveAlpha = d->fRandom->nextBool();
return GrMatrixConvolutionEffect::Make(d->context(),
- d->textureProxy(texIdx),
+ std::move(proxy),
bounds,
kernelSize,
kernel.get(),