blob: ac54e6ae7bbdf1fd56478795304355b744ebf8d9 [file] [log] [blame]
bsalomon@google.com68b58c92013-01-17 16:50:08 +00001/*
Ethan Nicholas68990be2017-07-13 09:36:52 -04002 * Copyright 2017 Google Inc.
bsalomon@google.com68b58c92013-01-17 16:50:08 +00003 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
Ethan Nicholas130fb3f2018-02-01 12:14:34 -05008/**************************************************************************************************
9 *** This file was autogenerated from GrSimpleTextureEffect.fp; do not modify.
10 **************************************************************************************************/
bsalomon@google.com68b58c92013-01-17 16:50:08 +000011#ifndef GrSimpleTextureEffect_DEFINED
12#define GrSimpleTextureEffect_DEFINED
Ethan Nicholas68990be2017-07-13 09:36:52 -040013#include "SkTypes.h"
Ethan Nicholas68990be2017-07-13 09:36:52 -040014#include "GrFragmentProcessor.h"
15#include "GrCoordTransform.h"
Ethan Nicholas68990be2017-07-13 09:36:52 -040016class GrSimpleTextureEffect : public GrFragmentProcessor {
Ethan Nicholasbaf981f2017-07-12 13:51:34 +000017public:
Brian Salomonaff329b2017-08-11 09:40:37 -040018 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
Mike Kleind6ab77a2019-03-21 08:18:24 -050019 const SkMatrix& matrix) {
Brian Salomonaff329b2017-08-11 09:40:37 -040020 return std::unique_ptr<GrFragmentProcessor>(
Mike Kleind6ab77a2019-03-21 08:18:24 -050021 new GrSimpleTextureEffect(std::move(proxy), matrix,
Brian Salomon2bbdcc42017-09-07 12:36:34 -040022 GrSamplerState(GrSamplerState::WrapMode::kClamp,
23 GrSamplerState::Filter::kNearest)));
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040024 }
Robert Phillips901f29a2017-01-24 16:24:41 -050025
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070026 /* clamp mode */
Mike Kleind6ab77a2019-03-21 08:18:24 -050027 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
28 const SkMatrix& matrix,
Brian Salomon2bbdcc42017-09-07 12:36:34 -040029 GrSamplerState::Filter filter) {
30 return std::unique_ptr<GrFragmentProcessor>(new GrSimpleTextureEffect(
Mike Kleind6ab77a2019-03-21 08:18:24 -050031 std::move(proxy), matrix,
Brian Salomon2bbdcc42017-09-07 12:36:34 -040032 GrSamplerState(GrSamplerState::WrapMode::kClamp, filter)));
33 }
34
35 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
Mike Kleind6ab77a2019-03-21 08:18:24 -050036 const SkMatrix& matrix,
Brian Salomon2bbdcc42017-09-07 12:36:34 -040037 const GrSamplerState& p) {
Brian Salomonaff329b2017-08-11 09:40:37 -040038 return std::unique_ptr<GrFragmentProcessor>(
Brian Osman2240be92017-10-18 13:15:13 -040039 new GrSimpleTextureEffect(std::move(proxy), matrix, p));
Robert Phillips901f29a2017-01-24 16:24:41 -050040 }
Ethan Nicholasf57c0d62017-07-31 11:18:22 -040041 GrSimpleTextureEffect(const GrSimpleTextureEffect& src);
Brian Salomonaff329b2017-08-11 09:40:37 -040042 std::unique_ptr<GrFragmentProcessor> clone() const override;
Mike Kleind6ab77a2019-03-21 08:18:24 -050043 const char* name() const override { return "SimpleTextureEffect"; }
Ethan Nicholasbcd51e82019-04-09 10:40:41 -040044 GrCoordTransform imageCoordTransform;
45 TextureSampler image;
46 SkMatrix44 matrix;
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040047
bsalomon@google.com68b58c92013-01-17 16:50:08 +000048private:
Mike Kleind6ab77a2019-03-21 08:18:24 -050049 GrSimpleTextureEffect(sk_sp<GrTextureProxy> image, SkMatrix44 matrix,
50 GrSamplerState samplerParams)
Ethan Nicholasabff9562017-10-09 10:54:08 -040051 : INHERITED(kGrSimpleTextureEffect_ClassID,
Michael Ludwig257a03d2018-12-13 14:07:07 -050052 (OptimizationFlags)ModulateForSamplerOptFlags(
53 image->config(),
54 samplerParams.wrapModeX() ==
55 GrSamplerState::WrapMode::kClampToBorder ||
56 samplerParams.wrapModeY() ==
57 GrSamplerState::WrapMode::kClampToBorder))
Ethan Nicholasbcd51e82019-04-09 10:40:41 -040058 , imageCoordTransform(matrix, image.get())
59 , image(std::move(image), samplerParams)
60 , matrix(matrix) {
Brian Salomonf7dcd762018-07-30 14:48:15 -040061 this->setTextureSamplerCnt(1);
Ethan Nicholasbcd51e82019-04-09 10:40:41 -040062 this->addCoordTransform(&imageCoordTransform);
Ethan Nicholas68990be2017-07-13 09:36:52 -040063 }
egdaniel57d3b032015-11-13 11:57:27 -080064 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040065 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
Ethan Nicholas68990be2017-07-13 09:36:52 -040066 bool onIsEqual(const GrFragmentProcessor&) const override;
Brian Salomonf7dcd762018-07-30 14:48:15 -040067 const TextureSampler& onTextureSampler(int) const override;
Brian Salomon0c26a9d2017-07-06 10:09:38 -040068 GR_DECLARE_FRAGMENT_PROCESSOR_TEST
Ethan Nicholas68990be2017-07-13 09:36:52 -040069 typedef GrFragmentProcessor INHERITED;
bsalomon@google.com68b58c92013-01-17 16:50:08 +000070};
Ethan Nicholas68990be2017-07-13 09:36:52 -040071#endif