blob: e2b10e8cb7f34897c74a34f0a25a75aad500663a [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
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040027 static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> image,
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040028 sk_sp<GrColorSpaceXform>
29 colorXform,
30 sk_sp<GrTextureProxy>
31 mask,
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040032 float innerThreshold,
33 float outerThreshold,
34 const SkIRect& bounds) {
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040035 return sk_sp<GrFragmentProcessor>(new GrAlphaThresholdFragmentProcessor(
36 image, colorXform, mask, innerThreshold, outerThreshold, bounds));
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040037 }
38 const char* name() const override { return "AlphaThresholdFragmentProcessor"; }
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040039
robertphillipsf7142e72016-04-18 07:20:05 -070040private:
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040041 GrAlphaThresholdFragmentProcessor(sk_sp<GrTextureProxy> image,
42 sk_sp<GrColorSpaceXform> colorXform,
43 sk_sp<GrTextureProxy> mask, float innerThreshold,
44 float outerThreshold, const SkIRect& bounds)
45 : INHERITED(kNone_OptimizationFlags)
46 , fImage(std::move(image))
47 , fColorXform(colorXform)
48 , fMask(std::move(mask))
49 , fInnerThreshold(innerThreshold)
50 , fOuterThreshold(outerThreshold)
51 , fImageCoordTransform(SkMatrix::I(), fImage.proxy())
52 , fMaskCoordTransform(
53 SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())),
54 fMask.proxy()) {
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040055 this->addTextureSampler(&fImage);
56 this->addTextureSampler(&fMask);
Ethan Nicholas68990be2017-07-13 09:36:52 -040057 this->addCoordTransform(&fImageCoordTransform);
58 this->addCoordTransform(&fMaskCoordTransform);
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040059 this->initClassID<GrAlphaThresholdFragmentProcessor>();
60 }
robertphillipsf7142e72016-04-18 07:20:05 -070061 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040062 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
robertphillipsf7142e72016-04-18 07:20:05 -070063 bool onIsEqual(const GrFragmentProcessor&) const override;
Brian Salomon0c26a9d2017-07-06 10:09:38 -040064 GR_DECLARE_FRAGMENT_PROCESSOR_TEST
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040065 TextureSampler fImage;
66 sk_sp<GrColorSpaceXform> fColorXform;
67 TextureSampler fMask;
robertphillipsf7142e72016-04-18 07:20:05 -070068 float fInnerThreshold;
69 float fOuterThreshold;
Ethan Nicholas68990be2017-07-13 09:36:52 -040070 GrCoordTransform fImageCoordTransform;
71 GrCoordTransform fMaskCoordTransform;
robertphillipsf7142e72016-04-18 07:20:05 -070072 typedef GrFragmentProcessor INHERITED;
73};
Ethan Nicholasceb4d482017-07-10 15:40:20 -040074#endif
robertphillipsf7142e72016-04-18 07:20:05 -070075#endif