| 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 { | |
| 14 GrGPInput fInputColorType; | |
| 15 GrGPInput fInputCoverageType; | |
| 16 GrColor fColor; | |
| 17 bool fUsesLocalCoords; | |
| 18 }; | |
| 19 | |
| 20 /* | 13 /* |
| 21 * The path equivalent of the GP. For now this just manages color. In the long
term we plan on | 14 * 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. | 15 * extending this class to handle all nvpr uniform / varying / program work. |
| 23 */ | 16 */ |
| 24 class GrPathProcessor : public GrPrimitiveProcessor { | 17 class GrPathProcessor : public GrPrimitiveProcessor { |
| 25 public: | 18 public: |
| 26 static GrPathProcessor* Create(GrColor color, | 19 static GrPathProcessor* Create(GrColor color, |
| 27 const GrPipelineOptimizations& opts, | 20 const GrPipelineOptimizations& opts, |
| 28 const SkMatrix& viewMatrix = SkMatrix::I(), | 21 const SkMatrix& viewMatrix = SkMatrix::I(), |
| 29 const SkMatrix& localMatrix = SkMatrix::I())
{ | 22 const SkMatrix& localMatrix = SkMatrix::I())
{ |
| 30 return new GrPathProcessor(color, opts, viewMatrix, localMatrix); | 23 return new GrPathProcessor(color, opts, viewMatrix, localMatrix); |
| 31 } | 24 } |
| 32 | 25 |
| 33 void initBatchTracker(GrBatchTracker*, const GrPipelineOptimizations&) const
override; | |
| 34 | |
| 35 bool isEqual(const GrBatchTracker& mine, | |
| 36 const GrPrimitiveProcessor& that, | |
| 37 const GrBatchTracker& theirs) const; | |
| 38 | |
| 39 const char* name() const override { return "PathProcessor"; } | 26 const char* name() const override { return "PathProcessor"; } |
| 40 | 27 |
| 41 GrColor color() const { return fColor; } | 28 GrColor color() const { return fColor; } |
| 42 const SkMatrix& viewMatrix() const { return fViewMatrix; } | 29 const SkMatrix& viewMatrix() const { return fViewMatrix; } |
| 43 const SkMatrix& localMatrix() const { return fLocalMatrix; } | 30 const SkMatrix& localMatrix() const { return fLocalMatrix; } |
| 44 | 31 |
| 45 void getInvariantOutputColor(GrInitInvariantOutput* out) const override; | |
| 46 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override; | |
| 47 | |
| 48 bool willUseGeoShader() const override { return false; } | 32 bool willUseGeoShader() const override { return false; } |
| 49 | 33 |
| 50 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 34 virtual void getGLProcessorKey(const GrGLSLCaps& caps, |
| 51 const GrGLSLCaps& caps, | |
| 52 GrProcessorKeyBuilder* b) const override; | 35 GrProcessorKeyBuilder* b) const override; |
| 53 | 36 |
| 54 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 37 virtual GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps& caps) con
st override; |
| 55 const GrGLSLCaps& caps) con
st override; | |
| 56 | 38 |
| 57 bool hasTransformedLocalCoords() const override { return false; } | 39 bool hasTransformedLocalCoords() const override { return false; } |
| 58 | 40 |
| 59 const GrPipelineOptimizations& opts() const { return fOpts; } | 41 const GrPipelineOptimizations& opts() const { return fOpts; } |
| 60 | 42 |
| 61 private: | 43 private: |
| 62 GrPathProcessor(GrColor color, const GrPipelineOptimizations& opts, | 44 GrPathProcessor(GrColor color, const GrPipelineOptimizations& opts, |
| 63 const SkMatrix& viewMatrix, const SkMatrix& localMatrix); | 45 const SkMatrix& viewMatrix, const SkMatrix& localMatrix); |
| 64 | 46 |
| 65 bool hasExplicitLocalCoords() const override { return false; } | 47 bool hasExplicitLocalCoords() const override { return false; } |
| 66 | 48 |
| 67 GrColor fColor; | 49 GrColor fColor; |
| 68 const SkMatrix fViewMatrix; | 50 const SkMatrix fViewMatrix; |
| 69 const SkMatrix fLocalMatrix; | 51 const SkMatrix fLocalMatrix; |
| 70 GrPipelineOptimizations fOpts; | 52 GrPipelineOptimizations fOpts; |
| 71 | 53 |
| 72 typedef GrPrimitiveProcessor INHERITED; | 54 typedef GrPrimitiveProcessor INHERITED; |
| 73 }; | 55 }; |
| 74 | 56 |
| 75 #endif | 57 #endif |
| OLD | NEW |