blob: 702b6aeb887f370c90b0649cdf03680e6065602a [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"
19#include "effects/GrProxyMove.h"
robertphillipsf7142e72016-04-18 07:20:05 -070020class GrAlphaThresholdFragmentProcessor : public GrFragmentProcessor {
robertphillipsf7142e72016-04-18 07:20:05 -070021public:
robertphillipsf7142e72016-04-18 07:20:05 -070022
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040023 inline OptimizationFlags optFlags(float outerThreshold);
24 sk_sp<GrColorSpaceXform> colorXform() const { return fColorXform; }
robertphillipsf7142e72016-04-18 07:20:05 -070025 float innerThreshold() const { return fInnerThreshold; }
26 float outerThreshold() const { return fOuterThreshold; }
27
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040028 static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> image,
29 sk_sp<GrColorSpaceXform> colorXform,
30 sk_sp<GrTextureProxy> mask,
31 float innerThreshold,
32 float outerThreshold,
33 const SkIRect& bounds) {
34 return sk_sp<GrFragmentProcessor>(new GrAlphaThresholdFragmentProcessor(image,
35 colorXform,
36 mask,
37 innerThreshold,
38 outerThreshold,
39 bounds));
40 }
41 const char* name() const override { return "AlphaThresholdFragmentProcessor"; }
robertphillipsf7142e72016-04-18 07:20:05 -070042private:
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040043 GrAlphaThresholdFragmentProcessor(sk_sp<GrTextureProxy> image, sk_sp<GrColorSpaceXform> colorXform, sk_sp<GrTextureProxy> mask, float innerThreshold, float outerThreshold,
44 const SkIRect& bounds
45)
46 : INHERITED(kNone_OptimizationFlags)
Ethan Nicholasbaf981f2017-07-12 13:51:34 +000047 ,
48 fImageCoordTransform(SkMatrix::I(), image.get()),
49 fMaskCoordTransform(SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())),
50 mask.get())
51
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040052 , fImage(std::move(image))
53 , fColorXform(colorXform)
54 , fMask(std::move(mask))
55 , fInnerThreshold(innerThreshold)
Ethan Nicholasbaf981f2017-07-12 13:51:34 +000056 , fOuterThreshold(outerThreshold) {
57
58 this->addCoordTransform(&fImageCoordTransform);
59 this->addCoordTransform(&fMaskCoordTransform);
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040060 this->addTextureSampler(&fImage);
61 this->addTextureSampler(&fMask);
62 this->initClassID<GrAlphaThresholdFragmentProcessor>();
63 }
robertphillipsf7142e72016-04-18 07:20:05 -070064 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040065 void onGetGLSLProcessorKey(const GrShaderCaps&,GrProcessorKeyBuilder*) const override;
robertphillipsf7142e72016-04-18 07:20:05 -070066 bool onIsEqual(const GrFragmentProcessor&) const override;
Brian Salomon0c26a9d2017-07-06 10:09:38 -040067 GR_DECLARE_FRAGMENT_PROCESSOR_TEST
Ethan Nicholasbaf981f2017-07-12 13:51:34 +000068
69 GrCoordTransform fImageCoordTransform;
70 GrCoordTransform fMaskCoordTransform;
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040071 TextureSampler fImage;
72 sk_sp<GrColorSpaceXform> fColorXform;
73 TextureSampler fMask;
robertphillipsf7142e72016-04-18 07:20:05 -070074 float fInnerThreshold;
75 float fOuterThreshold;
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