OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrPathProcessor_DEFINED | 8 #ifndef GrPathProcessor_DEFINED |
9 #define GrPathProcessor_DEFINED | 9 #define GrPathProcessor_DEFINED |
10 | 10 |
11 #include "GrPrimitiveProcessor.h" | 11 #include "GrPrimitiveProcessor.h" |
12 | 12 |
13 struct PathBatchTracker { | 13 struct PathBatchTracker { |
14 GrGPInput fInputColorType; | 14 GrGPInput fInputColorType; |
15 GrGPInput fInputCoverageType; | 15 GrGPInput fInputCoverageType; |
16 GrColor fColor; | 16 GrColor fColor; |
17 bool fUsesLocalCoords; | 17 bool fUsesLocalCoords; |
18 }; | 18 }; |
19 | 19 |
20 /* | 20 /* |
21 * The path equivalent of the GP. For now this just manages color. In the long
term we plan on | 21 * The path equivalent of the GP. For now this just manages color. In the long
term we plan on |
22 * extending this class to handle all nvpr uniform / varying / program work. | 22 * extending this class to handle all nvpr uniform / varying / program work. |
23 */ | 23 */ |
24 class GrPathProcessor : public GrPrimitiveProcessor { | 24 class GrPathProcessor : public GrPrimitiveProcessor { |
25 public: | 25 public: |
26 static GrPathProcessor* Create(GrColor color, | 26 static GrPathProcessor* Create(GrColor color, |
| 27 const GrPipelineOptimizations& opts, |
27 const SkMatrix& viewMatrix = SkMatrix::I(), | 28 const SkMatrix& viewMatrix = SkMatrix::I(), |
28 const SkMatrix& localMatrix = SkMatrix::I())
{ | 29 const SkMatrix& localMatrix = SkMatrix::I())
{ |
29 return new GrPathProcessor(color, viewMatrix, localMatrix); | 30 return new GrPathProcessor(color, opts, viewMatrix, localMatrix); |
30 } | 31 } |
31 | 32 |
32 void initBatchTracker(GrBatchTracker*, const GrPipelineOptimizations&) const
override; | 33 void initBatchTracker(GrBatchTracker*, const GrPipelineOptimizations&) const
override; |
33 | 34 |
34 bool isEqual(const GrBatchTracker& mine, | 35 bool isEqual(const GrBatchTracker& mine, |
35 const GrPrimitiveProcessor& that, | 36 const GrPrimitiveProcessor& that, |
36 const GrBatchTracker& theirs) const; | 37 const GrBatchTracker& theirs) const; |
37 | 38 |
38 const char* name() const override { return "PathProcessor"; } | 39 const char* name() const override { return "PathProcessor"; } |
39 | 40 |
40 GrColor color() const { return fColor; } | 41 GrColor color() const { return fColor; } |
41 const SkMatrix& viewMatrix() const { return fViewMatrix; } | 42 const SkMatrix& viewMatrix() const { return fViewMatrix; } |
42 const SkMatrix& localMatrix() const { return fLocalMatrix; } | 43 const SkMatrix& localMatrix() const { return fLocalMatrix; } |
43 | 44 |
44 | |
45 void getInvariantOutputColor(GrInitInvariantOutput* out) const override; | 45 void getInvariantOutputColor(GrInitInvariantOutput* out) const override; |
46 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override; | 46 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override; |
47 | 47 |
48 bool willUseGeoShader() const override { return false; } | 48 bool willUseGeoShader() const override { return false; } |
49 | 49 |
50 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 50 virtual void getGLProcessorKey(const GrBatchTracker& bt, |
51 const GrGLSLCaps& caps, | 51 const GrGLSLCaps& caps, |
52 GrProcessorKeyBuilder* b) const override; | 52 GrProcessorKeyBuilder* b) const override; |
53 | 53 |
54 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 54 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, |
55 const GrGLSLCaps& caps) con
st override; | 55 const GrGLSLCaps& caps) con
st override; |
56 | 56 |
57 bool hasTransformedLocalCoords() const override { return false; } | 57 bool hasTransformedLocalCoords() const override { return false; } |
58 | 58 |
| 59 const GrPipelineOptimizations& opts() const { return fOpts; } |
| 60 |
59 private: | 61 private: |
60 GrPathProcessor(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& l
ocalMatrix); | 62 GrPathProcessor(GrColor color, const GrPipelineOptimizations& opts, |
| 63 const SkMatrix& viewMatrix, const SkMatrix& localMatrix); |
61 | 64 |
62 bool hasExplicitLocalCoords() const override { return false; } | 65 bool hasExplicitLocalCoords() const override { return false; } |
63 | 66 |
64 GrColor fColor; | 67 GrColor fColor; |
65 const SkMatrix fViewMatrix; | 68 const SkMatrix fViewMatrix; |
66 const SkMatrix fLocalMatrix; | 69 const SkMatrix fLocalMatrix; |
| 70 GrPipelineOptimizations fOpts; |
67 | 71 |
68 typedef GrPrimitiveProcessor INHERITED; | 72 typedef GrPrimitiveProcessor INHERITED; |
69 }; | 73 }; |
70 | 74 |
71 #endif | 75 #endif |
OLD | NEW |