| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "GrGeometryProcessor.h" | 8 #include "GrGeometryProcessor.h" |
| 9 | 9 |
| 10 #include "gl/GrGLGeometryProcessor.h" | 10 #include "gl/GrGLGeometryProcessor.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 UniformHandle fColorUniform; | 116 UniformHandle fColorUniform; |
| 117 GrColor fColor; | 117 GrColor fColor; |
| 118 | 118 |
| 119 typedef GrGLGeometryProcessor INHERITED; | 119 typedef GrGLGeometryProcessor INHERITED; |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 GrPathProcessor::GrPathProcessor(GrColor color, const SkMatrix& localMatrix) | 122 GrPathProcessor::GrPathProcessor(GrColor color, |
| 123 : INHERITED(localMatrix) | 123 const SkMatrix& viewMatrix, |
| 124 const SkMatrix& localMatrix) |
| 125 : INHERITED(viewMatrix, localMatrix) |
| 124 , fColor(color) { | 126 , fColor(color) { |
| 125 this->initClassID<GrPathProcessor>(); | 127 this->initClassID<GrPathProcessor>(); |
| 126 } | 128 } |
| 127 | 129 |
| 128 void GrPathProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const
{ | 130 void GrPathProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const
{ |
| 129 out->setKnownFourComponents(fColor); | 131 out->setKnownFourComponents(fColor); |
| 130 } | 132 } |
| 131 | 133 |
| 132 void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con
st { | 134 void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con
st { |
| 133 out->setKnownSingleComponent(0xff); | 135 out->setKnownSingleComponent(0xff); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 148 local->fUsesLocalCoords = init.fUsesLocalCoords; | 150 local->fUsesLocalCoords = init.fUsesLocalCoords; |
| 149 } | 151 } |
| 150 | 152 |
| 151 bool GrPathProcessor::canMakeEqual(const GrBatchTracker& m, | 153 bool GrPathProcessor::canMakeEqual(const GrBatchTracker& m, |
| 152 const GrPrimitiveProcessor& that, | 154 const GrPrimitiveProcessor& that, |
| 153 const GrBatchTracker& t) const { | 155 const GrBatchTracker& t) const { |
| 154 if (this->classID() != that.classID() || !this->hasSameTextureAccesses(that)
) { | 156 if (this->classID() != that.classID() || !this->hasSameTextureAccesses(that)
) { |
| 155 return false; | 157 return false; |
| 156 } | 158 } |
| 157 | 159 |
| 160 if (!this->viewMatrix().cheapEqualTo(that.viewMatrix())) { |
| 161 return false; |
| 162 } |
| 163 |
| 158 const PathBatchTracker& mine = m.cast<PathBatchTracker>(); | 164 const PathBatchTracker& mine = m.cast<PathBatchTracker>(); |
| 159 const PathBatchTracker& theirs = t.cast<PathBatchTracker>(); | 165 const PathBatchTracker& theirs = t.cast<PathBatchTracker>(); |
| 160 return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords, | 166 return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords, |
| 161 that, theirs.fUsesLocalCoords) && | 167 that, theirs.fUsesLocalCoords) && |
| 162 CanCombineOutput(mine.fInputColorType, mine.fColor, | 168 CanCombineOutput(mine.fInputColorType, mine.fColor, |
| 163 theirs.fInputColorType, theirs.fColor) && | 169 theirs.fInputColorType, theirs.fColor) && |
| 164 CanCombineOutput(mine.fInputCoverageType, 0xff, | 170 CanCombineOutput(mine.fInputCoverageType, 0xff, |
| 165 theirs.fInputCoverageType, 0xff); | 171 theirs.fInputCoverageType, 0xff); |
| 166 } | 172 } |
| 167 | 173 |
| 168 void GrPathProcessor::getGLProcessorKey(const GrBatchTracker& bt, | 174 void GrPathProcessor::getGLProcessorKey(const GrBatchTracker& bt, |
| 169 const GrGLCaps& caps, | 175 const GrGLCaps& caps, |
| 170 GrProcessorKeyBuilder* b) const { | 176 GrProcessorKeyBuilder* b) const { |
| 171 GrGLPathProcessor::GenKey(*this, bt, caps, b); | 177 GrGLPathProcessor::GenKey(*this, bt, caps, b); |
| 172 } | 178 } |
| 173 | 179 |
| 174 GrGLGeometryProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& b
t) const { | 180 GrGLGeometryProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& b
t) const { |
| 175 return SkNEW_ARGS(GrGLPathProcessor, (*this, bt)); | 181 return SkNEW_ARGS(GrGLPathProcessor, (*this, bt)); |
| 176 } | 182 } |
| OLD | NEW |