| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 private: | 114 private: |
| 115 UniformHandle fColorUniform; | 115 UniformHandle fColorUniform; |
| 116 GrColor fColor; | 116 GrColor fColor; |
| 117 | 117 |
| 118 typedef GrGLGeometryProcessor INHERITED; | 118 typedef GrGLGeometryProcessor INHERITED; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 GrPathProcessor::GrPathProcessor(GrColor color) : fColor(color) { | 121 GrPathProcessor::GrPathProcessor(GrColor color, const SkMatrix& localMatrix) |
| 122 : fColor(color) |
| 123 , fLocalMatrix(localMatrix) { |
| 122 this->initClassID<GrPathProcessor>(); | 124 this->initClassID<GrPathProcessor>(); |
| 123 } | 125 } |
| 124 | 126 |
| 125 void GrPathProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const
{ | 127 void GrPathProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const
{ |
| 126 out->setKnownFourComponents(fColor); | 128 out->setKnownFourComponents(fColor); |
| 127 } | 129 } |
| 128 | 130 |
| 129 void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con
st { | 131 void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con
st { |
| 130 out->setKnownSingleComponent(0xff); | 132 out->setKnownSingleComponent(0xff); |
| 131 } | 133 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 144 local->fInputCoverageType = init.fCoverageIgnored ? kIgnored_GrGPInput : kAl
lOnes_GrGPInput; | 146 local->fInputCoverageType = init.fCoverageIgnored ? kIgnored_GrGPInput : kAl
lOnes_GrGPInput; |
| 145 } | 147 } |
| 146 | 148 |
| 147 bool GrPathProcessor::canMakeEqual(const GrBatchTracker& m, | 149 bool GrPathProcessor::canMakeEqual(const GrBatchTracker& m, |
| 148 const GrPrimitiveProcessor& that, | 150 const GrPrimitiveProcessor& that, |
| 149 const GrBatchTracker& t) const { | 151 const GrBatchTracker& t) const { |
| 150 if (this->classID() != that.classID() || !this->hasSameTextureAccesses(that)
) { | 152 if (this->classID() != that.classID() || !this->hasSameTextureAccesses(that)
) { |
| 151 return false; | 153 return false; |
| 152 } | 154 } |
| 153 | 155 |
| 156 if (!fLocalMatrix.cheapEqualTo(that.localMatrix())) { |
| 157 return false; |
| 158 } |
| 159 |
| 154 const PathBatchTracker& mine = m.cast<PathBatchTracker>(); | 160 const PathBatchTracker& mine = m.cast<PathBatchTracker>(); |
| 155 const PathBatchTracker& theirs = t.cast<PathBatchTracker>(); | 161 const PathBatchTracker& theirs = t.cast<PathBatchTracker>(); |
| 156 return CanCombineOutput(mine.fInputColorType, mine.fColor, | 162 return CanCombineOutput(mine.fInputColorType, mine.fColor, |
| 157 theirs.fInputColorType, theirs.fColor) && | 163 theirs.fInputColorType, theirs.fColor) && |
| 158 CanCombineOutput(mine.fInputCoverageType, 0xff, | 164 CanCombineOutput(mine.fInputCoverageType, 0xff, |
| 159 theirs.fInputCoverageType, 0xff); | 165 theirs.fInputCoverageType, 0xff); |
| 160 } | 166 } |
| 161 | 167 |
| 162 void GrPathProcessor::getGLProcessorKey(const GrBatchTracker& bt, | 168 void GrPathProcessor::getGLProcessorKey(const GrBatchTracker& bt, |
| 163 const GrGLCaps& caps, | 169 const GrGLCaps& caps, |
| 164 GrProcessorKeyBuilder* b) const { | 170 GrProcessorKeyBuilder* b) const { |
| 165 GrGLPathProcessor::GenKey(*this, bt, caps, b); | 171 GrGLPathProcessor::GenKey(*this, bt, caps, b); |
| 166 } | 172 } |
| 167 | 173 |
| 168 GrGLGeometryProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& b
t) const { | 174 GrGLGeometryProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& b
t) const { |
| 169 return SkNEW_ARGS(GrGLPathProcessor, (*this, bt)); | 175 return SkNEW_ARGS(GrGLPathProcessor, (*this, bt)); |
| 170 } | 176 } |
| OLD | NEW |