aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrSimpleTextureEffect.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-01-30 08:06:27 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-30 13:40:15 +0000
commit40fd7c94c24bb30d888c3d85a79cbb96c7fbf800 (patch)
tree075e886c01de864ba982910f1854f47ba1ae95d8 /src/gpu/effects/GrSimpleTextureEffect.cpp
parent55b72530fedeb58154635531751a8730982fbf2a (diff)
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>
Diffstat (limited to 'src/gpu/effects/GrSimpleTextureEffect.cpp')
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.cpp40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index 682539ff3b..3dc6ea3a2c 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 @@ GrGLSLFragmentProcessor* GrSimpleTextureEffect::onCreateGLSLInstance() const {
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 @@ sk_sp<GrFragmentProcessor> GrSimpleTextureEffect::TestCreate(GrProcessorTestData
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);
}