Jim Van Verth | c590341 | 2016-11-17 15:27:09 -0500 | [diff] [blame] | 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: |
Brian Salomon | 0596909 | 2017-07-13 11:20:51 -0400 | [diff] [blame] | 22 | static sk_sp<GrGeometryProcessor> Make() { |
| 23 | return sk_sp<GrGeometryProcessor>(new GrRRectShadowGeoProc()); |
Jim Van Verth | c590341 | 2016-11-17 15:27:09 -0500 | [diff] [blame] | 24 | } |
| 25 | |
Jim Van Verth | c590341 | 2016-11-17 15:27:09 -0500 | [diff] [blame] | 26 | const char* name() const override { return "RRectShadow"; } |
| 27 | |
| 28 | const Attribute* inPosition() const { return fInPosition; } |
| 29 | const Attribute* inColor() const { return fInColor; } |
| 30 | const Attribute* inShadowParams() const { return fInShadowParams; } |
| 31 | GrColor color() const { return fColor; } |
Jim Van Verth | c590341 | 2016-11-17 15:27:09 -0500 | [diff] [blame] | 32 | |
Brian Salomon | 0596909 | 2017-07-13 11:20:51 -0400 | [diff] [blame] | 33 | void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {} |
Jim Van Verth | c590341 | 2016-11-17 15:27:09 -0500 | [diff] [blame] | 34 | |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 35 | GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; |
Jim Van Verth | c590341 | 2016-11-17 15:27:09 -0500 | [diff] [blame] | 36 | |
| 37 | private: |
Brian Salomon | 0596909 | 2017-07-13 11:20:51 -0400 | [diff] [blame] | 38 | GrRRectShadowGeoProc(); |
Jim Van Verth | c590341 | 2016-11-17 15:27:09 -0500 | [diff] [blame] | 39 | |
| 40 | GrColor fColor; |
Jim Van Verth | c590341 | 2016-11-17 15:27:09 -0500 | [diff] [blame] | 41 | const Attribute* fInPosition; |
| 42 | const Attribute* fInColor; |
| 43 | const Attribute* fInShadowParams; |
| 44 | |
Brian Salomon | 0c26a9d | 2017-07-06 10:09:38 -0400 | [diff] [blame] | 45 | GR_DECLARE_GEOMETRY_PROCESSOR_TEST |
Jim Van Verth | c590341 | 2016-11-17 15:27:09 -0500 | [diff] [blame] | 46 | |
| 47 | typedef GrGeometryProcessor INHERITED; |
| 48 | }; |
| 49 | |
| 50 | |
| 51 | #endif |