blob: 5e8730a5ddda2d2fc567498db9a5789467fa615c [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:
Michael Ludwiga4275592018-08-31 10:52:47 -040018 const SkMatrix44& matrix() const { return fMatrix; }
Ethan Nicholas68990be2017-07-13 09:36:52 -040019
Brian Salomonaff329b2017-08-11 09:40:37 -040020 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
Brian Salomonaff329b2017-08-11 09:40:37 -040021 const SkMatrix& matrix) {
Brian Salomonaff329b2017-08-11 09:40:37 -040022 return std::unique_ptr<GrFragmentProcessor>(
Brian Osman2240be92017-10-18 13:15:13 -040023 new GrSimpleTextureEffect(std::move(proxy), matrix,
Brian Salomon2bbdcc42017-09-07 12:36:34 -040024 GrSamplerState(GrSamplerState::WrapMode::kClamp,
25 GrSamplerState::Filter::kNearest)));
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040026 }
Robert Phillips901f29a2017-01-24 16:24:41 -050027
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070028 /* clamp mode */
Brian Salomonaff329b2017-08-11 09:40:37 -040029 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
Brian Salomonaff329b2017-08-11 09:40:37 -040030 const SkMatrix& matrix,
Brian Salomon2bbdcc42017-09-07 12:36:34 -040031 GrSamplerState::Filter filter) {
32 return std::unique_ptr<GrFragmentProcessor>(new GrSimpleTextureEffect(
Brian Osman2240be92017-10-18 13:15:13 -040033 std::move(proxy), matrix,
Brian Salomon2bbdcc42017-09-07 12:36:34 -040034 GrSamplerState(GrSamplerState::WrapMode::kClamp, filter)));
35 }
36
37 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
Brian Salomon2bbdcc42017-09-07 12:36:34 -040038 const SkMatrix& matrix,
39 const GrSamplerState& p) {
Brian Salomonaff329b2017-08-11 09:40:37 -040040 return std::unique_ptr<GrFragmentProcessor>(
Brian Osman2240be92017-10-18 13:15:13 -040041 new GrSimpleTextureEffect(std::move(proxy), matrix, p));
Robert Phillips901f29a2017-01-24 16:24:41 -050042 }
Ethan Nicholasf57c0d62017-07-31 11:18:22 -040043 GrSimpleTextureEffect(const GrSimpleTextureEffect& src);
Brian Salomonaff329b2017-08-11 09:40:37 -040044 std::unique_ptr<GrFragmentProcessor> clone() const override;
Ethan Nicholas68990be2017-07-13 09:36:52 -040045 const char* name() const override { return "SimpleTextureEffect"; }
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040046
bsalomon@google.com68b58c92013-01-17 16:50:08 +000047private:
Brian Osman2240be92017-10-18 13:15:13 -040048 GrSimpleTextureEffect(sk_sp<GrTextureProxy> image, SkMatrix44 matrix,
49 GrSamplerState samplerParams)
Ethan Nicholasabff9562017-10-09 10:54:08 -040050 : INHERITED(kGrSimpleTextureEffect_ClassID,
Michael Ludwig257a03d2018-12-13 14:07:07 -050051 (OptimizationFlags)ModulateForSamplerOptFlags(
52 image->config(),
53 samplerParams.wrapModeX() ==
54 GrSamplerState::WrapMode::kClampToBorder ||
55 samplerParams.wrapModeY() ==
56 GrSamplerState::WrapMode::kClampToBorder))
Robert Phillipsa98183a2018-03-23 11:44:25 +000057 , fImage(std::move(image), samplerParams)
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040058 , fMatrix(matrix)
59 , fImageCoordTransform(matrix, fImage.proxy()) {
Brian Salomonf7dcd762018-07-30 14:48:15 -040060 this->setTextureSamplerCnt(1);
Ethan Nicholas68990be2017-07-13 09:36:52 -040061 this->addCoordTransform(&fImageCoordTransform);
Ethan Nicholas68990be2017-07-13 09:36:52 -040062 }
egdaniel57d3b032015-11-13 11:57:27 -080063 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040064 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
Ethan Nicholas68990be2017-07-13 09:36:52 -040065 bool onIsEqual(const GrFragmentProcessor&) const override;
Brian Salomonf7dcd762018-07-30 14:48:15 -040066 const TextureSampler& onTextureSampler(int) const override;
Brian Salomon0c26a9d2017-07-06 10:09:38 -040067 GR_DECLARE_FRAGMENT_PROCESSOR_TEST
Ethan Nicholas68990be2017-07-13 09:36:52 -040068 TextureSampler fImage;
Ethan Nicholas68990be2017-07-13 09:36:52 -040069 SkMatrix44 fMatrix;
70 GrCoordTransform fImageCoordTransform;
71 typedef GrFragmentProcessor INHERITED;
bsalomon@google.com68b58c92013-01-17 16:50:08 +000072};
Ethan Nicholas68990be2017-07-13 09:36:52 -040073#endif