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, |
joshualitt | f238469 | 2015-09-10 11:00:51 -0700 | [diff] [blame] | 20 | const GrPipelineOptimizations& opts, |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 21 | const SkMatrix& viewMatrix = SkMatrix::I(), |
| 22 | const SkMatrix& localMatrix = SkMatrix::I()) { |
joshualitt | f238469 | 2015-09-10 11:00:51 -0700 | [diff] [blame] | 23 | return new GrPathProcessor(color, opts, 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 | |
joshualitt | 465283c | 2015-09-11 08:19:35 -0700 | [diff] [blame] | 34 | virtual void getGLProcessorKey(const GrGLSLCaps& caps, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 35 | GrProcessorKeyBuilder* b) const override; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 36 | |
joshualitt | 465283c | 2015-09-11 08:19:35 -0700 | [diff] [blame] | 37 | virtual GrGLPrimitiveProcessor* createGLInstance(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 | |
joshualitt | f238469 | 2015-09-10 11:00:51 -0700 | [diff] [blame] | 41 | const GrPipelineOptimizations& opts() const { return fOpts; } |
| 42 | |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 43 | private: |
joshualitt | f238469 | 2015-09-10 11:00:51 -0700 | [diff] [blame] | 44 | GrPathProcessor(GrColor color, const GrPipelineOptimizations& opts, |
| 45 | const SkMatrix& viewMatrix, const SkMatrix& localMatrix); |
joshualitt | e3ababe | 2015-05-15 07:56:07 -0700 | [diff] [blame] | 46 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 47 | bool hasExplicitLocalCoords() const override { return false; } |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 48 | |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 49 | GrColor fColor; |
joshualitt | e3ababe | 2015-05-15 07:56:07 -0700 | [diff] [blame] | 50 | const SkMatrix fViewMatrix; |
| 51 | const SkMatrix fLocalMatrix; |
joshualitt | f238469 | 2015-09-10 11:00:51 -0700 | [diff] [blame] | 52 | GrPipelineOptimizations fOpts; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 53 | |
| 54 | typedef GrPrimitiveProcessor INHERITED; |
| 55 | }; |
| 56 | |
| 57 | #endif |