blob: 556c2c37f1659b7e70d9ebbedcb1eeb005df8a4d [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050013#include "include/core/SkTypes.h"
14
15#include "src/gpu/GrCoordTransform.h"
16#include "src/gpu/GrFragmentProcessor.h"
Ethan Nicholas68990be2017-07-13 09:36:52 -040017class GrSimpleTextureEffect : public GrFragmentProcessor {
Ethan Nicholasbaf981f2017-07-12 13:51:34 +000018public:
Brian Salomonaff329b2017-08-11 09:40:37 -040019 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
Mike Kleind6ab77a2019-03-21 08:18:24 -050020 const SkMatrix& matrix) {
Brian Salomonaff329b2017-08-11 09:40:37 -040021 return std::unique_ptr<GrFragmentProcessor>(
Mike Kleind6ab77a2019-03-21 08:18:24 -050022 new GrSimpleTextureEffect(std::move(proxy), matrix,
Brian Salomon2bbdcc42017-09-07 12:36:34 -040023 GrSamplerState(GrSamplerState::WrapMode::kClamp,
24 GrSamplerState::Filter::kNearest)));
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040025 }
Robert Phillips901f29a2017-01-24 16:24:41 -050026
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070027 /* clamp mode */
Mike Kleind6ab77a2019-03-21 08:18:24 -050028 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
29 const SkMatrix& matrix,
Brian Salomon2bbdcc42017-09-07 12:36:34 -040030 GrSamplerState::Filter filter) {
31 return std::unique_ptr<GrFragmentProcessor>(new GrSimpleTextureEffect(
Mike Kleind6ab77a2019-03-21 08:18:24 -050032 std::move(proxy), matrix,
Brian Salomon2bbdcc42017-09-07 12:36:34 -040033 GrSamplerState(GrSamplerState::WrapMode::kClamp, filter)));
34 }
35
36 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
Mike Kleind6ab77a2019-03-21 08:18:24 -050037 const SkMatrix& matrix,
Brian Salomon2bbdcc42017-09-07 12:36:34 -040038 const GrSamplerState& p) {
Brian Salomonaff329b2017-08-11 09:40:37 -040039 return std::unique_ptr<GrFragmentProcessor>(
Brian Osman2240be92017-10-18 13:15:13 -040040 new GrSimpleTextureEffect(std::move(proxy), matrix, p));
Robert Phillips901f29a2017-01-24 16:24:41 -050041 }
Ethan Nicholasf57c0d62017-07-31 11:18:22 -040042 GrSimpleTextureEffect(const GrSimpleTextureEffect& src);
Brian Salomonaff329b2017-08-11 09:40:37 -040043 std::unique_ptr<GrFragmentProcessor> clone() const override;
Mike Kleind6ab77a2019-03-21 08:18:24 -050044 const char* name() const override { return "SimpleTextureEffect"; }
Ethan Nicholasbcd51e82019-04-09 10:40:41 -040045 GrCoordTransform imageCoordTransform;
46 TextureSampler image;
47 SkMatrix44 matrix;
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040048
bsalomon@google.com68b58c92013-01-17 16:50:08 +000049private:
Mike Kleind6ab77a2019-03-21 08:18:24 -050050 GrSimpleTextureEffect(sk_sp<GrTextureProxy> image, SkMatrix44 matrix,
51 GrSamplerState samplerParams)
Ethan Nicholasabff9562017-10-09 10:54:08 -040052 : INHERITED(kGrSimpleTextureEffect_ClassID,
Michael Ludwig257a03d2018-12-13 14:07:07 -050053 (OptimizationFlags)ModulateForSamplerOptFlags(
54 image->config(),
55 samplerParams.wrapModeX() ==
56 GrSamplerState::WrapMode::kClampToBorder ||
57 samplerParams.wrapModeY() ==
58 GrSamplerState::WrapMode::kClampToBorder))
Ethan Nicholasbcd51e82019-04-09 10:40:41 -040059 , imageCoordTransform(matrix, image.get())
60 , image(std::move(image), samplerParams)
61 , matrix(matrix) {
Brian Salomonf7dcd762018-07-30 14:48:15 -040062 this->setTextureSamplerCnt(1);
Ethan Nicholasbcd51e82019-04-09 10:40:41 -040063 this->addCoordTransform(&imageCoordTransform);
Ethan Nicholas68990be2017-07-13 09:36:52 -040064 }
egdaniel57d3b032015-11-13 11:57:27 -080065 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040066 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
Ethan Nicholas68990be2017-07-13 09:36:52 -040067 bool onIsEqual(const GrFragmentProcessor&) const override;
Brian Salomonf7dcd762018-07-30 14:48:15 -040068 const TextureSampler& onTextureSampler(int) const override;
Brian Salomon0c26a9d2017-07-06 10:09:38 -040069 GR_DECLARE_FRAGMENT_PROCESSOR_TEST
Ethan Nicholas68990be2017-07-13 09:36:52 -040070 typedef GrFragmentProcessor INHERITED;
bsalomon@google.com68b58c92013-01-17 16:50:08 +000071};
Ethan Nicholas68990be2017-07-13 09:36:52 -040072#endif