| 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 GrPrimitiveProcessor_DEFINED | 8 #ifndef GrPrimitiveProcessor_DEFINED |
| 9 #define GrPrimitiveProcessor_DEFINED | 9 #define GrPrimitiveProcessor_DEFINED |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 /* | 98 /* |
| 99 * GrPrimitiveProcessor defines an interface which all subclasses must implement
. All | 99 * GrPrimitiveProcessor defines an interface which all subclasses must implement
. All |
| 100 * GrPrimitiveProcessors must proivide seed color and coverage for the Ganesh co
lor / coverage | 100 * GrPrimitiveProcessors must proivide seed color and coverage for the Ganesh co
lor / coverage |
| 101 * pipelines, and they must provide some notion of equality | 101 * pipelines, and they must provide some notion of equality |
| 102 */ | 102 */ |
| 103 class GrPrimitiveProcessor : public GrProcessor { | 103 class GrPrimitiveProcessor : public GrProcessor { |
| 104 public: | 104 public: |
| 105 // TODO let the PrimProc itself set this in its setData call, this should re
ally live on the | 105 // TODO let the PrimProc itself set this in its setData call, this should re
ally live on the |
| 106 // bundle of primitive data | 106 // bundle of primitive data |
| 107 const SkMatrix& viewMatrix() const { return fViewMatrix; } | |
| 108 const SkMatrix& localMatrix() const { return fLocalMatrix; } | 107 const SkMatrix& localMatrix() const { return fLocalMatrix; } |
| 109 | 108 |
| 110 virtual void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const
= 0; | 109 virtual void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const
= 0; |
| 111 | 110 |
| 112 virtual bool canMakeEqual(const GrBatchTracker& mine, | 111 virtual bool canMakeEqual(const GrBatchTracker& mine, |
| 113 const GrPrimitiveProcessor& that, | 112 const GrPrimitiveProcessor& that, |
| 114 const GrBatchTracker& theirs) const = 0; | 113 const GrBatchTracker& theirs) const = 0; |
| 115 | 114 |
| 116 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; | 115 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; |
| 117 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const =
0; | 116 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const =
0; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 166 |
| 168 /** Returns a new instance of the appropriate *GL* implementation class | 167 /** Returns a new instance of the appropriate *GL* implementation class |
| 169 for the given GrProcessor; caller is responsible for deleting | 168 for the given GrProcessor; caller is responsible for deleting |
| 170 the object. */ | 169 the object. */ |
| 171 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 170 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, |
| 172 const GrGLSLCaps& caps) con
st = 0; | 171 const GrGLSLCaps& caps) con
st = 0; |
| 173 | 172 |
| 174 bool isPathRendering() const { return fIsPathRendering; } | 173 bool isPathRendering() const { return fIsPathRendering; } |
| 175 | 174 |
| 176 protected: | 175 protected: |
| 177 GrPrimitiveProcessor(const SkMatrix& viewMatrix, const SkMatrix& localMatrix
, | 176 GrPrimitiveProcessor(const SkMatrix& localMatrix, bool isPathRendering) |
| 178 bool isPathRendering) | |
| 179 : fNumAttribs(0) | 177 : fNumAttribs(0) |
| 180 , fVertexStride(0) | 178 , fVertexStride(0) |
| 181 , fViewMatrix(viewMatrix) | |
| 182 , fLocalMatrix(localMatrix) | 179 , fLocalMatrix(localMatrix) |
| 183 , fIsPathRendering(isPathRendering) {} | 180 , fIsPathRendering(isPathRendering) {} |
| 184 | 181 |
| 185 /* | 182 /* |
| 186 * CanCombineOutput will return true if two draws are 'batchable' from a col
or perspective. | 183 * CanCombineOutput will return true if two draws are 'batchable' from a col
or perspective. |
| 187 * TODO remove this when GPs can upgrade to attribute color | 184 * TODO remove this when GPs can upgrade to attribute color |
| 188 */ | 185 */ |
| 189 static bool CanCombineOutput(GrGPInput left, GrColor lColor, GrGPInput right
, GrColor rColor) { | 186 static bool CanCombineOutput(GrGPInput left, GrColor lColor, GrGPInput right
, GrColor rColor) { |
| 190 if (left != right) { | 187 if (left != right) { |
| 191 return false; | 188 return false; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 212 return true; | 209 return true; |
| 213 } | 210 } |
| 214 | 211 |
| 215 Attribute fAttribs[kMaxVertexAttribs]; | 212 Attribute fAttribs[kMaxVertexAttribs]; |
| 216 int fNumAttribs; | 213 int fNumAttribs; |
| 217 size_t fVertexStride; | 214 size_t fVertexStride; |
| 218 | 215 |
| 219 private: | 216 private: |
| 220 virtual bool hasExplicitLocalCoords() const = 0; | 217 virtual bool hasExplicitLocalCoords() const = 0; |
| 221 | 218 |
| 222 const SkMatrix fViewMatrix; | |
| 223 SkMatrix fLocalMatrix; | 219 SkMatrix fLocalMatrix; |
| 224 bool fIsPathRendering; | 220 bool fIsPathRendering; |
| 225 | 221 |
| 226 typedef GrProcessor INHERITED; | 222 typedef GrProcessor INHERITED; |
| 227 }; | 223 }; |
| 228 | 224 |
| 229 #endif | 225 #endif |
| OLD | NEW |