joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 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 GrPathProcessor_DEFINED |
| 9 | #define GrPathProcessor_DEFINED |
| 10 | |
| 11 | #include "GrPrimitiveProcessor.h" |
| 12 | |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 13 | /* |
| 14 | * The path equivalent of the GP. For now this just manages color. In the long term we plan on |
| 15 | * extending this class to handle all nvpr uniform / varying / program work. |
| 16 | */ |
| 17 | class GrPathProcessor : public GrPrimitiveProcessor { |
| 18 | public: |
Brian Osman | cf86085 | 2018-10-31 14:04:39 -0400 | [diff] [blame] | 19 | static GrPathProcessor* Create(const SkPMColor4f& color, |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 20 | const SkMatrix& viewMatrix = SkMatrix::I(), |
| 21 | const SkMatrix& localMatrix = SkMatrix::I()) { |
Brian Salomon | ecea86a | 2017-01-04 13:25:17 -0500 | [diff] [blame] | 22 | return new GrPathProcessor(color, viewMatrix, localMatrix); |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 23 | } |
| 24 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 25 | const char* name() const override { return "PathProcessor"; } |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 26 | |
Brian Osman | cf86085 | 2018-10-31 14:04:39 -0400 | [diff] [blame] | 27 | const SkPMColor4f& color() const { return fColor; } |
joshualitt | e3ababe | 2015-05-15 07:56:07 -0700 | [diff] [blame] | 28 | const SkMatrix& viewMatrix() const { return fViewMatrix; } |
| 29 | const SkMatrix& localMatrix() const { return fLocalMatrix; } |
| 30 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 31 | bool willUseGeoShader() const override { return false; } |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 32 | |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 33 | virtual void getGLSLProcessorKey(const GrShaderCaps& caps, |
egdaniel | 57d3b03 | 2015-11-13 11:57:27 -0800 | [diff] [blame] | 34 | GrProcessorKeyBuilder* b) const override; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 35 | |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 36 | virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 37 | |
ethannicholas | 2279325 | 2016-01-30 09:59:10 -0800 | [diff] [blame] | 38 | virtual bool isPathRendering() const override { return true; } |
| 39 | |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 40 | private: |
Brian Osman | cf86085 | 2018-10-31 14:04:39 -0400 | [diff] [blame] | 41 | GrPathProcessor(const SkPMColor4f&, const SkMatrix& viewMatrix, const SkMatrix& localMatrix); |
joshualitt | e3ababe | 2015-05-15 07:56:07 -0700 | [diff] [blame] | 42 | |
Brian Osman | cf86085 | 2018-10-31 14:04:39 -0400 | [diff] [blame] | 43 | SkPMColor4f fColor; |
joshualitt | e3ababe | 2015-05-15 07:56:07 -0700 | [diff] [blame] | 44 | const SkMatrix fViewMatrix; |
| 45 | const SkMatrix fLocalMatrix; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 46 | |
| 47 | typedef GrPrimitiveProcessor INHERITED; |
| 48 | }; |
| 49 | |
| 50 | #endif |