| 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 GrGeometryProcessor_DEFINED | 8 #ifndef GrGeometryProcessor_DEFINED |
| 9 #define GrGeometryProcessor_DEFINED | 9 #define GrGeometryProcessor_DEFINED |
| 10 | 10 |
| 11 #include "GrPrimitiveProcessor.h" | 11 #include "GrPrimitiveProcessor.h" |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * A GrGeometryProcessor is a flexible method for rendering a primitive. The Gr
GeometryProcessor | 14 * A GrGeometryProcessor is a flexible method for rendering a primitive. The Gr
GeometryProcessor |
| 15 * has complete control over vertex attributes and uniforms(aside from the rende
r target) but it | 15 * has complete control over vertex attributes and uniforms(aside from the rende
r target) but it |
| 16 * must obey the same contract as any GrPrimitiveProcessor, specifically it must
emit a color and | 16 * must obey the same contract as any GrPrimitiveProcessor, specifically it must
emit a color and |
| 17 * coverage into the fragment shader. Where this color and coverage come from i
s completely the | 17 * coverage into the fragment shader. Where this color and coverage come from i
s completely the |
| 18 * responsibility of the GrGeometryProcessor. | 18 * responsibility of the GrGeometryProcessor. |
| 19 */ | 19 */ |
| 20 class GrGeometryProcessor : public GrPrimitiveProcessor { | 20 class GrGeometryProcessor : public GrPrimitiveProcessor { |
| 21 public: | 21 public: |
| 22 // TODO the Hint can be handled in a much more clean way when we have deferr
ed geometry or | 22 GrGeometryProcessor(const SkMatrix& viewMatrix = SkMatrix::I(), |
| 23 // atleast bundles | |
| 24 GrGeometryProcessor(GrColor color, | |
| 25 const SkMatrix& viewMatrix = SkMatrix::I(), | |
| 26 const SkMatrix& localMatrix = SkMatrix::I()) | 23 const SkMatrix& localMatrix = SkMatrix::I()) |
| 27 : INHERITED(viewMatrix, localMatrix, false) | 24 : INHERITED(viewMatrix, localMatrix, false) |
| 28 , fColor(color) | |
| 29 , fWillUseGeoShader(false) | 25 , fWillUseGeoShader(false) |
| 30 , fHasLocalCoords(false) {} | 26 , fHasLocalCoords(false) {} |
| 31 | 27 |
| 32 bool willUseGeoShader() const { return fWillUseGeoShader; } | 28 bool willUseGeoShader() const { return fWillUseGeoShader; } |
| 33 | 29 |
| 34 // TODO delete this when paths are in batch | 30 // TODO delete this when paths are in batch |
| 35 bool canMakeEqual(const GrBatchTracker& mine, | 31 bool canMakeEqual(const GrBatchTracker& mine, |
| 36 const GrPrimitiveProcessor& that, | 32 const GrPrimitiveProcessor& that, |
| 37 const GrBatchTracker& theirs) const override { | 33 const GrBatchTracker& theirs) const override { |
| 38 SkFAIL("Unsupported\n"); | 34 SkFAIL("Unsupported\n"); |
| 39 return false; | 35 return false; |
| 40 } | 36 } |
| 41 | |
| 42 // TODO we can remove color from the GrGeometryProcessor base class once we
have bundles of | |
| 43 // primitive data | |
| 44 GrColor color() const { return fColor; } | |
| 45 | 37 |
| 46 // TODO Delete when paths are in batch | 38 // TODO Delete when paths are in batch |
| 47 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 39 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 48 SkFAIL("Unsupported\n"); | 40 SkFAIL("Unsupported\n"); |
| 49 } | 41 } |
| 50 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 42 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 51 SkFAIL("Unsupported\n"); | 43 SkFAIL("Unsupported\n"); |
| 52 } | 44 } |
| 53 | 45 |
| 54 protected: | 46 protected: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 90 } |
| 99 | 91 |
| 100 void setWillUseGeoShader() { fWillUseGeoShader = true; } | 92 void setWillUseGeoShader() { fWillUseGeoShader = true; } |
| 101 | 93 |
| 102 // TODO hack see above | 94 // TODO hack see above |
| 103 void setHasLocalCoords() { fHasLocalCoords = true; } | 95 void setHasLocalCoords() { fHasLocalCoords = true; } |
| 104 | 96 |
| 105 private: | 97 private: |
| 106 bool hasExplicitLocalCoords() const override { return fHasLocalCoords; } | 98 bool hasExplicitLocalCoords() const override { return fHasLocalCoords; } |
| 107 | 99 |
| 108 GrColor fColor; | |
| 109 bool fWillUseGeoShader; | 100 bool fWillUseGeoShader; |
| 110 bool fHasLocalCoords; | 101 bool fHasLocalCoords; |
| 111 | 102 |
| 112 typedef GrPrimitiveProcessor INHERITED; | 103 typedef GrPrimitiveProcessor INHERITED; |
| 113 }; | 104 }; |
| 114 | 105 |
| 115 #endif | 106 #endif |
| OLD | NEW |