Push GrTextureProxy down to more effects
Change-Id: Ie3f32a88f25af082c25bc6daf3fe24e303e80f9e
Reviewed-on: https://skia-review.googlesource.com/7616
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index 682539f..3dc6ea3 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -7,11 +7,38 @@
#include "GrSimpleTextureEffect.h"
#include "GrInvariantOutput.h"
+#include "GrProxyMove.h"
#include "GrTexture.h"
#include "glsl/GrGLSLColorSpaceXformHelper.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
+GrSimpleTextureEffect::GrSimpleTextureEffect(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
+ sk_sp<GrColorSpaceXform> colorSpaceXform,
+ const SkMatrix& matrix,
+ GrSamplerParams::FilterMode filterMode)
+ : INHERITED{ctx,
+ ModulationFlags(proxy->config()),
+ GR_PROXY_MOVE(proxy),
+ std::move(colorSpaceXform),
+ matrix,
+ filterMode} {
+ this->initClassID<GrSimpleTextureEffect>();
+}
+
+GrSimpleTextureEffect::GrSimpleTextureEffect(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
+ sk_sp<GrColorSpaceXform> colorSpaceXform,
+ const SkMatrix& matrix,
+ const GrSamplerParams& params)
+ : INHERITED{ctx,
+ ModulationFlags(proxy->config()),
+ GR_PROXY_MOVE(proxy),
+ std::move(colorSpaceXform),
+ matrix,
+ params} {
+ this->initClassID<GrSimpleTextureEffect>();
+}
+
class GrGLSimpleTextureEffect : public GrGLSLFragmentProcessor {
public:
void emitCode(EmitArgs& args) override {
@@ -70,8 +97,8 @@
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSimpleTextureEffect);
sk_sp<GrFragmentProcessor> GrSimpleTextureEffect::TestCreate(GrProcessorTestData* d) {
- int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
- GrProcessorUnitTest::kAlphaTextureIdx;
+ int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
+ : GrProcessorUnitTest::kAlphaTextureIdx;
static const SkShader::TileMode kTileModes[] = {
SkShader::kClamp_TileMode,
SkShader::kRepeat_TileMode,
@@ -81,10 +108,11 @@
kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
};
- GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode :
- GrSamplerParams::kNone_FilterMode);
+ GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode
+ : GrSamplerParams::kNone_FilterMode);
const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom);
- auto colorSpaceXform = GrTest::TestColorXform(d->fRandom);
- return GrSimpleTextureEffect::Make(d->fTextures[texIdx], colorSpaceXform, matrix);
+ sk_sp<GrColorSpaceXform> colorSpaceXform = GrTest::TestColorXform(d->fRandom);
+ return GrSimpleTextureEffect::Make(d->context(), d->textureProxy(texIdx),
+ std::move(colorSpaceXform), matrix);
}