blob: fb4e3735b9c14bbcb7d2212d73b5fef5a733ea9e [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,
51 (OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag |
52 (GrPixelConfigIsOpaque(image->config())
53 ? kPreservesOpaqueInput_OptimizationFlag
54 : kNone_OptimizationFlags))
Robert Phillipsa98183a2018-03-23 11:44:25 +000055 , fImage(std::move(image), samplerParams)
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040056 , fMatrix(matrix)
57 , fImageCoordTransform(matrix, fImage.proxy()) {
Brian Salomonf7dcd762018-07-30 14:48:15 -040058 this->setTextureSamplerCnt(1);
Ethan Nicholas68990be2017-07-13 09:36:52 -040059 this->addCoordTransform(&fImageCoordTransform);
Ethan Nicholas68990be2017-07-13 09:36:52 -040060 }
egdaniel57d3b032015-11-13 11:57:27 -080061 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040062 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
Ethan Nicholas68990be2017-07-13 09:36:52 -040063 bool onIsEqual(const GrFragmentProcessor&) const override;
Brian Salomonf7dcd762018-07-30 14:48:15 -040064 const TextureSampler& onTextureSampler(int) const override;
Brian Salomon0c26a9d2017-07-06 10:09:38 -040065 GR_DECLARE_FRAGMENT_PROCESSOR_TEST
Ethan Nicholas68990be2017-07-13 09:36:52 -040066 TextureSampler fImage;
Ethan Nicholas68990be2017-07-13 09:36:52 -040067 SkMatrix44 fMatrix;
68 GrCoordTransform fImageCoordTransform;
69 typedef GrFragmentProcessor INHERITED;
bsalomon@google.com68b58c92013-01-17 16:50:08 +000070};
Ethan Nicholas68990be2017-07-13 09:36:52 -040071#endif