blob: 5dd669ac146e2cae24b037f46cb84109b8340fa1 [file] [log] [blame]
robertphillipsf7142e72016-04-18 07:20:05 -07001/*
Ethan Nicholas9fb036f2017-07-05 16:19:09 -04002 * Copyright 2017 Google Inc.
robertphillipsf7142e72016-04-18 07:20:05 -07003 *
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 Nicholas9fb036f2017-07-05 16:19:09 -04008/*
9 * This file was autogenerated from GrAlphaThresholdFragmentProcessor.fp; do not modify.
10 */
robertphillipsf7142e72016-04-18 07:20:05 -070011#ifndef GrAlphaThresholdFragmentProcessor_DEFINED
12#define GrAlphaThresholdFragmentProcessor_DEFINED
Ethan Nicholasceb4d482017-07-10 15:40:20 -040013#include "SkTypes.h"
14#if SK_SUPPORT_GPU
robertphillipsf7142e72016-04-18 07:20:05 -070015
Brian Salomon0c26a9d2017-07-06 10:09:38 -040016 #include "GrColorSpaceXform.h"
robertphillipsf7142e72016-04-18 07:20:05 -070017#include "GrFragmentProcessor.h"
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040018#include "GrCoordTransform.h"
Ethan Nicholas68990be2017-07-13 09:36:52 -040019#include "GrColorSpaceXform.h"
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040020#include "effects/GrProxyMove.h"
robertphillipsf7142e72016-04-18 07:20:05 -070021class GrAlphaThresholdFragmentProcessor : public GrFragmentProcessor {
robertphillipsf7142e72016-04-18 07:20:05 -070022public:
robertphillipsf7142e72016-04-18 07:20:05 -070023
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040024 inline OptimizationFlags optFlags(float outerThreshold);
25 sk_sp<GrColorSpaceXform> colorXform() const { return fColorXform; }
robertphillipsf7142e72016-04-18 07:20:05 -070026 float innerThreshold() const { return fInnerThreshold; }
27 float outerThreshold() const { return fOuterThreshold; }
28
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040029 static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> image,
30 sk_sp<GrColorSpaceXform> colorXform,
31 sk_sp<GrTextureProxy> mask,
32 float innerThreshold,
33 float outerThreshold,
34 const SkIRect& bounds) {
35 return sk_sp<GrFragmentProcessor>(new GrAlphaThresholdFragmentProcessor(image,
36 colorXform,
37 mask,
38 innerThreshold,
39 outerThreshold,
40 bounds));
41 }
42 const char* name() const override { return "AlphaThresholdFragmentProcessor"; }
robertphillipsf7142e72016-04-18 07:20:05 -070043private:
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040044 GrAlphaThresholdFragmentProcessor(sk_sp<GrTextureProxy> image, sk_sp<GrColorSpaceXform> colorXform, sk_sp<GrTextureProxy> mask, float innerThreshold, float outerThreshold,
45 const SkIRect& bounds
46)
47 : INHERITED(kNone_OptimizationFlags)
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040048 , fImage(std::move(image))
49 , fColorXform(colorXform)
50 , fMask(std::move(mask))
51 , fInnerThreshold(innerThreshold)
Ethan Nicholas68990be2017-07-13 09:36:52 -040052 , fOuterThreshold(outerThreshold)
53 , fImageCoordTransform(
54 SkMatrix::I()
55, fImage.proxy())
56 , fMaskCoordTransform(
57 SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y()))
58, fMask.proxy()) {
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040059 this->addTextureSampler(&fImage);
60 this->addTextureSampler(&fMask);
Ethan Nicholas68990be2017-07-13 09:36:52 -040061 this->addCoordTransform(&fImageCoordTransform);
62 this->addCoordTransform(&fMaskCoordTransform);
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040063 this->initClassID<GrAlphaThresholdFragmentProcessor>();
64 }
robertphillipsf7142e72016-04-18 07:20:05 -070065 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040066 void onGetGLSLProcessorKey(const GrShaderCaps&,GrProcessorKeyBuilder*) const override;
robertphillipsf7142e72016-04-18 07:20:05 -070067 bool onIsEqual(const GrFragmentProcessor&) const override;
Brian Salomon0c26a9d2017-07-06 10:09:38 -040068 GR_DECLARE_FRAGMENT_PROCESSOR_TEST
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040069 TextureSampler fImage;
70 sk_sp<GrColorSpaceXform> fColorXform;
71 TextureSampler fMask;
robertphillipsf7142e72016-04-18 07:20:05 -070072 float fInnerThreshold;
73 float fOuterThreshold;
Ethan Nicholas68990be2017-07-13 09:36:52 -040074 GrCoordTransform fImageCoordTransform;
75 GrCoordTransform fMaskCoordTransform;
robertphillipsf7142e72016-04-18 07:20:05 -070076 typedef GrFragmentProcessor INHERITED;
77};
Ethan Nicholasceb4d482017-07-10 15:40:20 -040078#endif
robertphillipsf7142e72016-04-18 07:20:05 -070079#endif