blob: 3b649516c1d73f8cc28de2cdf9450441da068941 [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
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -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"
robertphillipsf7142e72016-04-18 07:20:05 -070020class GrAlphaThresholdFragmentProcessor : public GrFragmentProcessor {
robertphillipsf7142e72016-04-18 07:20:05 -070021public:
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040022 inline OptimizationFlags optFlags(float outerThreshold);
23 sk_sp<GrColorSpaceXform> colorXform() const { return fColorXform; }
robertphillipsf7142e72016-04-18 07:20:05 -070024 float innerThreshold() const { return fInnerThreshold; }
25 float outerThreshold() const { return fOuterThreshold; }
26
Brian Salomonaff329b2017-08-11 09:40:37 -040027 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> image,
28 sk_sp<GrColorSpaceXform>
29 colorXform,
30 sk_sp<GrTextureProxy>
31 mask,
32 float innerThreshold,
33 float outerThreshold,
34 const SkIRect& bounds) {
35 return std::unique_ptr<GrFragmentProcessor>(new GrAlphaThresholdFragmentProcessor(
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040036 image, colorXform, mask, innerThreshold, outerThreshold, bounds));
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040037 }
Ethan Nicholasf57c0d62017-07-31 11:18:22 -040038 GrAlphaThresholdFragmentProcessor(const GrAlphaThresholdFragmentProcessor& src);
Brian Salomonaff329b2017-08-11 09:40:37 -040039 std::unique_ptr<GrFragmentProcessor> clone() const override;
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040040 const char* name() const override { return "AlphaThresholdFragmentProcessor"; }
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040041
robertphillipsf7142e72016-04-18 07:20:05 -070042private:
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040043 GrAlphaThresholdFragmentProcessor(sk_sp<GrTextureProxy> image,
44 sk_sp<GrColorSpaceXform> colorXform,
45 sk_sp<GrTextureProxy> mask, float innerThreshold,
46 float outerThreshold, const SkIRect& bounds)
47 : INHERITED(kNone_OptimizationFlags)
48 , fImage(std::move(image))
49 , fColorXform(colorXform)
50 , fMask(std::move(mask))
51 , fInnerThreshold(innerThreshold)
52 , fOuterThreshold(outerThreshold)
53 , fImageCoordTransform(SkMatrix::I(), fImage.proxy())
54 , fMaskCoordTransform(
55 SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())),
56 fMask.proxy()) {
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040057 this->addTextureSampler(&fImage);
58 this->addTextureSampler(&fMask);
Ethan Nicholas68990be2017-07-13 09:36:52 -040059 this->addCoordTransform(&fImageCoordTransform);
60 this->addCoordTransform(&fMaskCoordTransform);
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040061 this->initClassID<GrAlphaThresholdFragmentProcessor>();
62 }
robertphillipsf7142e72016-04-18 07:20:05 -070063 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040064 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
robertphillipsf7142e72016-04-18 07:20:05 -070065 bool onIsEqual(const GrFragmentProcessor&) const override;
Brian Salomon0c26a9d2017-07-06 10:09:38 -040066 GR_DECLARE_FRAGMENT_PROCESSOR_TEST
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040067 TextureSampler fImage;
68 sk_sp<GrColorSpaceXform> fColorXform;
69 TextureSampler fMask;
robertphillipsf7142e72016-04-18 07:20:05 -070070 float fInnerThreshold;
71 float fOuterThreshold;
Ethan Nicholas68990be2017-07-13 09:36:52 -040072 GrCoordTransform fImageCoordTransform;
73 GrCoordTransform fMaskCoordTransform;
robertphillipsf7142e72016-04-18 07:20:05 -070074 typedef GrFragmentProcessor INHERITED;
75};
Ethan Nicholasceb4d482017-07-10 15:40:20 -040076#endif
robertphillipsf7142e72016-04-18 07:20:05 -070077#endif