OLD | NEW |
(Empty) | |
| 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 |
| 13 struct PathBatchTracker { |
| 14 GrGPInput fInputColorType; |
| 15 GrGPInput fInputCoverageType; |
| 16 GrColor fColor; |
| 17 bool fUsesLocalCoords; |
| 18 }; |
| 19 |
| 20 /* |
| 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. |
| 23 */ |
| 24 class GrPathProcessor : public GrPrimitiveProcessor { |
| 25 public: |
| 26 static GrPathProcessor* Create(GrColor color, |
| 27 const SkMatrix& viewMatrix = SkMatrix::I(), |
| 28 const SkMatrix& localMatrix = SkMatrix::I())
{ |
| 29 return SkNEW_ARGS(GrPathProcessor, (color, viewMatrix, localMatrix)); |
| 30 } |
| 31 |
| 32 void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const SK_OVERR
IDE; |
| 33 |
| 34 bool canMakeEqual(const GrBatchTracker& mine, |
| 35 const GrPrimitiveProcessor& that, |
| 36 const GrBatchTracker& theirs) const SK_OVERRIDE; |
| 37 |
| 38 const char* name() const SK_OVERRIDE { return "PathProcessor"; } |
| 39 |
| 40 GrColor color() const { return fColor; } |
| 41 |
| 42 void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE; |
| 43 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRID
E; |
| 44 |
| 45 bool willUseGeoShader() const SK_OVERRIDE { return false; } |
| 46 |
| 47 virtual void getGLProcessorKey(const GrBatchTracker& bt, |
| 48 const GrGLCaps& caps, |
| 49 GrProcessorKeyBuilder* b) const SK_OVERRIDE; |
| 50 |
| 51 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, |
| 52 const GrGLCaps& caps) const
SK_OVERRIDE; |
| 53 |
| 54 protected: |
| 55 GrPathProcessor(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& l
ocalMatrix); |
| 56 |
| 57 private: |
| 58 bool hasExplicitLocalCoords() const SK_OVERRIDE { return false; } |
| 59 |
| 60 GrColor fColor; |
| 61 |
| 62 typedef GrPrimitiveProcessor INHERITED; |
| 63 }; |
| 64 |
| 65 #endif |
OLD | NEW |