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: |
| 19 | static GrPathProcessor* Create(GrColor color, |
ethannicholas | ff21032 | 2015-11-24 12:10:10 -0800 | [diff] [blame] | 20 | const GrXPOverridesForBatch& overrides, |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 21 | const SkMatrix& viewMatrix = SkMatrix::I(), |
| 22 | const SkMatrix& localMatrix = SkMatrix::I()) { |
ethannicholas | ff21032 | 2015-11-24 12:10:10 -0800 | [diff] [blame] | 23 | return new GrPathProcessor(color, overrides, viewMatrix, localMatrix); |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 24 | } |
| 25 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 26 | const char* name() const override { return "PathProcessor"; } |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 27 | |
| 28 | GrColor color() const { return fColor; } |
joshualitt | e3ababe | 2015-05-15 07:56:07 -0700 | [diff] [blame] | 29 | const SkMatrix& viewMatrix() const { return fViewMatrix; } |
| 30 | const SkMatrix& localMatrix() const { return fLocalMatrix; } |
| 31 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 32 | bool willUseGeoShader() const override { return false; } |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 33 | |
egdaniel | 57d3b03 | 2015-11-13 11:57:27 -0800 | [diff] [blame] | 34 | virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, |
| 35 | GrProcessorKeyBuilder* b) const override; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 36 | |
egdaniel | 57d3b03 | 2015-11-13 11:57:27 -0800 | [diff] [blame] | 37 | virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps) const override; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 38 | |
joshualitt | b2aa7cb | 2015-08-05 11:05:22 -0700 | [diff] [blame] | 39 | bool hasTransformedLocalCoords() const override { return false; } |
| 40 | |
ethannicholas | ff21032 | 2015-11-24 12:10:10 -0800 | [diff] [blame] | 41 | const GrXPOverridesForBatch& overrides() const { return fOverrides; } |
joshualitt | f238469 | 2015-09-10 11:00:51 -0700 | [diff] [blame] | 42 | |
ethannicholas | 2279325 | 2016-01-30 09:59:10 -0800 | [diff] [blame] | 43 | virtual bool isPathRendering() const override { return true; } |
| 44 | |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 45 | private: |
ethannicholas | ff21032 | 2015-11-24 12:10:10 -0800 | [diff] [blame] | 46 | GrPathProcessor(GrColor color, const GrXPOverridesForBatch& overrides, |
joshualitt | f238469 | 2015-09-10 11:00:51 -0700 | [diff] [blame] | 47 | const SkMatrix& viewMatrix, const SkMatrix& localMatrix); |
joshualitt | e3ababe | 2015-05-15 07:56:07 -0700 | [diff] [blame] | 48 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 49 | bool hasExplicitLocalCoords() const override { return false; } |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 50 | |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 51 | GrColor fColor; |
joshualitt | e3ababe | 2015-05-15 07:56:07 -0700 | [diff] [blame] | 52 | const SkMatrix fViewMatrix; |
| 53 | const SkMatrix fLocalMatrix; |
ethannicholas | ff21032 | 2015-11-24 12:10:10 -0800 | [diff] [blame] | 54 | GrXPOverridesForBatch fOverrides; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 55 | |
| 56 | typedef GrPrimitiveProcessor INHERITED; |
| 57 | }; |
| 58 | |
| 59 | #endif |