OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrProcessor.h" | 8 #include "GrProcessor.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrCoordTransform.h" | 10 #include "GrCoordTransform.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 return false; | 138 return false; |
139 } | 139 } |
140 for (int i = 0; i < this->numTextures(); ++i) { | 140 for (int i = 0; i < this->numTextures(); ++i) { |
141 if (this->textureAccess(i) != that.textureAccess(i)) { | 141 if (this->textureAccess(i) != that.textureAccess(i)) { |
142 return false; | 142 return false; |
143 } | 143 } |
144 } | 144 } |
145 return true; | 145 return true; |
146 } | 146 } |
147 | 147 |
148 void GrProcessor::computeInvariantOutput(GrInvariantOutput* inout) const { | |
149 this->onComputeInvariantOutput(inout); | |
150 } | |
151 | |
152 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 148 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
153 | 149 |
154 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { | 150 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { |
155 fCoordTransforms.push_back(transform); | 151 fCoordTransforms.push_back(transform); |
156 SkDEBUGCODE(transform->setInProcessor();) | 152 SkDEBUGCODE(transform->setInProcessor();) |
157 } | 153 } |
158 | 154 |
159 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con
st { | 155 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con
st { |
160 if (fCoordTransforms.count() != that.fCoordTransforms.count()) { | 156 if (fCoordTransforms.count() != that.fCoordTransforms.count()) { |
161 return false; | 157 return false; |
162 } | 158 } |
163 int count = fCoordTransforms.count(); | 159 int count = fCoordTransforms.count(); |
164 for (int i = 0; i < count; ++i) { | 160 for (int i = 0; i < count; ++i) { |
165 if (*fCoordTransforms[i] != *that.fCoordTransforms[i]) { | 161 if (*fCoordTransforms[i] != *that.fCoordTransforms[i]) { |
166 return false; | 162 return false; |
167 } | 163 } |
168 } | 164 } |
169 return true; | 165 return true; |
170 } | 166 } |
171 | 167 |
| 168 void GrFragmentProcessor::computeInvariantOutput(GrInvariantOutput* inout) const
{ |
| 169 this->onComputeInvariantOutput(inout); |
| 170 } |
| 171 |
172 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 172 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
173 | 173 |
174 void GrGeometryProcessor::computeInvariantColor(GrInvariantOutput* intout) const
{ | 174 void GrGeometryProcessor::getOutputColor(GrInitInvariantOutput* out) const { |
| 175 if (fHasVertexColor) { |
| 176 out->setUnknownFourComponents(); |
| 177 } else { |
| 178 out->setKnownFourComponents(fColor); |
| 179 } |
| 180 this->onGetOutputColor(out); |
| 181 } |
175 | 182 |
| 183 void GrGeometryProcessor::getOutputCoverage(GrInitInvariantOutput* out) const { |
| 184 this->onGetOutputCoverage(out); |
176 } | 185 } |
177 | 186 |
178 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 187 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 188 |
| 189 void GrPathProcessor::getOutputColor(GrInitInvariantOutput* out) const { |
| 190 out->setKnownFourComponents(fColor); |
| 191 } |
| 192 |
| 193 void GrPathProcessor::getOutputCoverage(GrInitInvariantOutput* out) const { |
| 194 out->setKnownSingleComponent(0xff); |
| 195 } |
| 196 |
| 197 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
179 | 198 |
180 /* | 199 /* |
181 * GrGeometryData shares the same pool so it lives in this file too | 200 * GrGeometryData shares the same pool so it lives in this file too |
182 */ | 201 */ |
183 void* GrGeometryData::operator new(size_t size) { | 202 void* GrGeometryData::operator new(size_t size) { |
184 return GrProcessor_Globals::GetTLS()->allocate(size); | 203 return GrProcessor_Globals::GetTLS()->allocate(size); |
185 } | 204 } |
186 | 205 |
187 void GrGeometryData::operator delete(void* target) { | 206 void GrGeometryData::operator delete(void* target) { |
188 GrProcessor_Globals::GetTLS()->release(target); | 207 GrProcessor_Globals::GetTLS()->release(target); |
189 } | 208 } |
190 | 209 |
191 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 210 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
192 | 211 |
193 // Initial static variable from GrXPFactory | 212 // Initial static variable from GrXPFactory |
194 int32_t GrXPFactory::gCurrXPFClassID = | 213 int32_t GrXPFactory::gCurrXPFClassID = |
195 GrXPFactory::kIllegalXPFClassID; | 214 GrXPFactory::kIllegalXPFClassID; |
196 | 215 |
| 216 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 217 |
| 218 void GrXferProcessor::computeInvariantOutput(GrInvariantOutput* inout) const { |
| 219 this->onComputeInvariantOutput(inout); |
| 220 } |
| 221 |
OLD | NEW |