blob: 3bc42a7dddfca831e98a30f7f546145b99f80e16 [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"
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:
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,
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040029 sk_sp<GrColorSpaceXform>
30 colorXform,
31 sk_sp<GrTextureProxy>
32 mask,
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040033 float innerThreshold,
34 float outerThreshold,
35 const SkIRect& bounds) {
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040036 return sk_sp<GrFragmentProcessor>(new GrAlphaThresholdFragmentProcessor(
37 image, colorXform, mask, innerThreshold, outerThreshold, bounds));
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040038 }
39 const char* name() const override { return "AlphaThresholdFragmentProcessor"; }
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040040
robertphillipsf7142e72016-04-18 07:20:05 -070041private:
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040042 GrAlphaThresholdFragmentProcessor(sk_sp<GrTextureProxy> image,
43 sk_sp<GrColorSpaceXform> colorXform,
44 sk_sp<GrTextureProxy> mask, float innerThreshold,
45 float outerThreshold, const SkIRect& bounds)
46 : INHERITED(kNone_OptimizationFlags)
47 , fImage(std::move(image))
48 , fColorXform(colorXform)
49 , fMask(std::move(mask))
50 , fInnerThreshold(innerThreshold)
51 , fOuterThreshold(outerThreshold)
52 , fImageCoordTransform(SkMatrix::I(), fImage.proxy())
53 , fMaskCoordTransform(
54 SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())),
55 fMask.proxy()) {
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040056 this->addTextureSampler(&fImage);
57 this->addTextureSampler(&fMask);
Ethan Nicholas68990be2017-07-13 09:36:52 -040058 this->addCoordTransform(&fImageCoordTransform);
59 this->addCoordTransform(&fMaskCoordTransform);
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040060 this->initClassID<GrAlphaThresholdFragmentProcessor>();
61 }
robertphillipsf7142e72016-04-18 07:20:05 -070062 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040063 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
robertphillipsf7142e72016-04-18 07:20:05 -070064 bool onIsEqual(const GrFragmentProcessor&) const override;
Brian Salomon0c26a9d2017-07-06 10:09:38 -040065 GR_DECLARE_FRAGMENT_PROCESSOR_TEST
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040066 TextureSampler fImage;
67 sk_sp<GrColorSpaceXform> fColorXform;
68 TextureSampler fMask;
robertphillipsf7142e72016-04-18 07:20:05 -070069 float fInnerThreshold;
70 float fOuterThreshold;
Ethan Nicholas68990be2017-07-13 09:36:52 -040071 GrCoordTransform fImageCoordTransform;
72 GrCoordTransform fMaskCoordTransform;
robertphillipsf7142e72016-04-18 07:20:05 -070073 typedef GrFragmentProcessor INHERITED;
74};
Ethan Nicholasceb4d482017-07-10 15:40:20 -040075#endif
robertphillipsf7142e72016-04-18 07:20:05 -070076#endif