| 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 |
| 148 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 152 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 149 | 153 |
| 150 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { | 154 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { |
| 151 fCoordTransforms.push_back(transform); | 155 fCoordTransforms.push_back(transform); |
| 152 SkDEBUGCODE(transform->setInProcessor();) | 156 SkDEBUGCODE(transform->setInProcessor();) |
| 153 } | 157 } |
| 154 | 158 |
| 155 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con
st { | 159 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con
st { |
| 156 if (fCoordTransforms.count() != that.fCoordTransforms.count()) { | 160 if (fCoordTransforms.count() != that.fCoordTransforms.count()) { |
| 157 return false; | 161 return false; |
| 158 } | 162 } |
| 159 int count = fCoordTransforms.count(); | 163 int count = fCoordTransforms.count(); |
| 160 for (int i = 0; i < count; ++i) { | 164 for (int i = 0; i < count; ++i) { |
| 161 if (*fCoordTransforms[i] != *that.fCoordTransforms[i]) { | 165 if (*fCoordTransforms[i] != *that.fCoordTransforms[i]) { |
| 162 return false; | 166 return false; |
| 163 } | 167 } |
| 164 } | 168 } |
| 165 return true; | 169 return true; |
| 166 } | 170 } |
| 167 | 171 |
| 168 void GrFragmentProcessor::computeInvariantOutput(GrInvariantOutput* inout) const
{ | |
| 169 this->onComputeInvariantOutput(inout); | |
| 170 } | |
| 171 | |
| 172 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 172 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 173 | 173 |
| 174 void GrGeometryProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) co
nst { | 174 void GrGeometryProcessor::computeInvariantColor(GrInvariantOutput* intout) const
{ |
| 175 if (fHasVertexColor) { | |
| 176 out->setUnknownFourComponents(); | |
| 177 } else { | |
| 178 out->setKnownFourComponents(fColor); | |
| 179 } | |
| 180 this->onGetInvariantOutputColor(out); | |
| 181 } | |
| 182 | 175 |
| 183 void GrGeometryProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out)
const { | |
| 184 this->onGetInvariantOutputCoverage(out); | |
| 185 } | 176 } |
| 186 | 177 |
| 187 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 178 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 188 | |
| 189 void GrPathProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const
{ | |
| 190 out->setKnownFourComponents(fColor); | |
| 191 } | |
| 192 | |
| 193 void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con
st { | |
| 194 out->setKnownSingleComponent(0xff); | |
| 195 } | |
| 196 | |
| 197 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | |
| 198 | 179 |
| 199 /* | 180 /* |
| 200 * GrGeometryData shares the same pool so it lives in this file too | 181 * GrGeometryData shares the same pool so it lives in this file too |
| 201 */ | 182 */ |
| 202 void* GrGeometryData::operator new(size_t size) { | 183 void* GrGeometryData::operator new(size_t size) { |
| 203 return GrProcessor_Globals::GetTLS()->allocate(size); | 184 return GrProcessor_Globals::GetTLS()->allocate(size); |
| 204 } | 185 } |
| 205 | 186 |
| 206 void GrGeometryData::operator delete(void* target) { | 187 void GrGeometryData::operator delete(void* target) { |
| 207 GrProcessor_Globals::GetTLS()->release(target); | 188 GrProcessor_Globals::GetTLS()->release(target); |
| 208 } | 189 } |
| 209 | 190 |
| 210 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 191 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 211 | 192 |
| 212 // Initial static variable from GrXPFactory | 193 // Initial static variable from GrXPFactory |
| 213 int32_t GrXPFactory::gCurrXPFClassID = | 194 int32_t GrXPFactory::gCurrXPFClassID = |
| 214 GrXPFactory::kIllegalXPFClassID; | 195 GrXPFactory::kIllegalXPFClassID; |
| 196 |
| OLD | NEW |