Line data Source code
1 : /*
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 :
11 : #include "GrProcessor.h"
12 : #include "GrGeometryProcessor.h"
13 :
14 : class GrGLRRectShadowGeoProc;
15 :
16 : /**
17 : * The output color of this effect is a coverage mask for a rrect shadow,
18 : * assuming circular corner geometry.
19 : */
20 : class GrRRectShadowGeoProc : public GrGeometryProcessor {
21 : public:
22 0 : static sk_sp<GrGeometryProcessor> Make(const SkMatrix& localMatrix) {
23 0 : return sk_sp<GrGeometryProcessor>(new GrRRectShadowGeoProc(localMatrix));
24 : }
25 :
26 0 : ~GrRRectShadowGeoProc() override {}
27 :
28 0 : const char* name() const override { return "RRectShadow"; }
29 :
30 0 : const Attribute* inPosition() const { return fInPosition; }
31 0 : const Attribute* inColor() const { return fInColor; }
32 0 : const Attribute* inShadowParams() const { return fInShadowParams; }
33 : GrColor color() const { return fColor; }
34 0 : const SkMatrix& localMatrix() const { return fLocalMatrix; }
35 :
36 : void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override;
37 :
38 : GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
39 :
40 : private:
41 : GrRRectShadowGeoProc(const SkMatrix& localMatrix);
42 :
43 : GrColor fColor;
44 : SkMatrix fLocalMatrix;
45 : const Attribute* fInPosition;
46 : const Attribute* fInColor;
47 : const Attribute* fInShadowParams;
48 :
49 : GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
50 :
51 : typedef GrGeometryProcessor INHERITED;
52 : };
53 :
54 :
55 : #endif
|