blob: b821a6a5055f2364e990309feda66d61a9b0993f [file] [log] [blame]
Jim Van Verthc5903412016-11-17 15:27:09 -05001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrShadowGeoProc_DEFINED
9#define GrShadowGeoProc_DEFINED
10
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "src/gpu/GrGeometryProcessor.h"
12#include "src/gpu/GrProcessor.h"
Jim Van Verthc5903412016-11-17 15:27:09 -050013
14class GrGLRRectShadowGeoProc;
15
16/**
17 * The output color of this effect is a coverage mask for a rrect shadow,
18 * assuming circular corner geometry.
19 */
20class GrRRectShadowGeoProc : public GrGeometryProcessor {
21public:
Brian Salomon05969092017-07-13 11:20:51 -040022 static sk_sp<GrGeometryProcessor> Make() {
23 return sk_sp<GrGeometryProcessor>(new GrRRectShadowGeoProc());
Jim Van Verthc5903412016-11-17 15:27:09 -050024 }
25
Jim Van Verthc5903412016-11-17 15:27:09 -050026 const char* name() const override { return "RRectShadow"; }
27
Brian Osmanf04fb3c2018-11-12 15:34:00 -050028 const Attribute& inPosition() const { return fInPosition; }
29 const Attribute& inColor() const { return fInColor; }
30 const Attribute& inShadowParams() const { return fInShadowParams; }
Jim Van Verthc5903412016-11-17 15:27:09 -050031 GrColor color() const { return fColor; }
Jim Van Verthc5903412016-11-17 15:27:09 -050032
Brian Salomon05969092017-07-13 11:20:51 -040033 void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {}
Jim Van Verthc5903412016-11-17 15:27:09 -050034
Brian Salomon94efbf52016-11-29 13:43:05 -050035 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
Jim Van Verthc5903412016-11-17 15:27:09 -050036
37private:
Brian Salomon05969092017-07-13 11:20:51 -040038 GrRRectShadowGeoProc();
Jim Van Verthc5903412016-11-17 15:27:09 -050039
40 GrColor fColor;
Brian Salomon92be2f72018-06-19 14:33:47 -040041
Brian Osmanf04fb3c2018-11-12 15:34:00 -050042 Attribute fInPosition;
43 Attribute fInColor;
44 Attribute fInShadowParams;
Jim Van Verthc5903412016-11-17 15:27:09 -050045
Brian Salomon0c26a9d2017-07-06 10:09:38 -040046 GR_DECLARE_GEOMETRY_PROCESSOR_TEST
Jim Van Verthc5903412016-11-17 15:27:09 -050047
48 typedef GrGeometryProcessor INHERITED;
49};
50
51
52#endif