| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 if (this->textureAccess(i) != that.textureAccess(i)) { | 124 if (this->textureAccess(i) != that.textureAccess(i)) { |
| 125 return false; | 125 return false; |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 return true; | 128 return true; |
| 129 } | 129 } |
| 130 | 130 |
| 131 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 131 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 132 | 132 |
| 133 GrFragmentProcessor::~GrFragmentProcessor() { | 133 GrFragmentProcessor::~GrFragmentProcessor() { |
| 134 // If we got here then our ref count must have reached zero, so we will have
converted refs |
| 135 // to pending executions for all children. |
| 134 for (int i = 0; i < fChildProcessors.count(); ++i) { | 136 for (int i = 0; i < fChildProcessors.count(); ++i) { |
| 135 fChildProcessors[i]->unref(); | 137 fChildProcessors[i]->completedExecution(); |
| 136 } | 138 } |
| 137 } | 139 } |
| 138 | 140 |
| 139 bool GrFragmentProcessor::isEqual(const GrFragmentProcessor& that, | 141 bool GrFragmentProcessor::isEqual(const GrFragmentProcessor& that, |
| 140 bool ignoreCoordTransforms) const { | 142 bool ignoreCoordTransforms) const { |
| 141 if (this->classID() != that.classID() || | 143 if (this->classID() != that.classID() || |
| 142 !this->hasSameTextureAccesses(that)) { | 144 !this->hasSameTextureAccesses(that)) { |
| 143 return false; | 145 return false; |
| 144 } | 146 } |
| 145 if (ignoreCoordTransforms) { | 147 if (ignoreCoordTransforms) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 this->setWillReadFragmentPosition(); | 213 this->setWillReadFragmentPosition(); |
| 212 } | 214 } |
| 213 | 215 |
| 214 if (child->usesLocalCoords()) { | 216 if (child->usesLocalCoords()) { |
| 215 fUsesLocalCoords = true; | 217 fUsesLocalCoords = true; |
| 216 } | 218 } |
| 217 | 219 |
| 218 return index; | 220 return index; |
| 219 } | 221 } |
| 220 | 222 |
| 223 void GrFragmentProcessor::notifyRefCntIsZero() const { |
| 224 // See comment above GrProgramElement for a detailed explanation of why we d
o this. |
| 225 for (int i = 0; i < fChildProcessors.count(); ++i) { |
| 226 fChildProcessors[i]->addPendingExecution(); |
| 227 fChildProcessors[i]->unref(); |
| 228 } |
| 229 } |
| 230 |
| 221 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con
st { | 231 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con
st { |
| 222 if (this->numTransforms() != that.numTransforms()) { | 232 if (this->numTransforms() != that.numTransforms()) { |
| 223 return false; | 233 return false; |
| 224 } | 234 } |
| 225 int count = this->numTransforms(); | 235 int count = this->numTransforms(); |
| 226 for (int i = 0; i < count; ++i) { | 236 for (int i = 0; i < count; ++i) { |
| 227 if (this->coordTransform(i) != that.coordTransform(i)) { | 237 if (this->coordTransform(i) != that.coordTransform(i)) { |
| 228 return false; | 238 return false; |
| 229 } | 239 } |
| 230 } | 240 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 244 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 254 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 245 | 255 |
| 246 // GrProcessorDataManager lives in the same pool | 256 // GrProcessorDataManager lives in the same pool |
| 247 void* GrProcessorDataManager::operator new(size_t size) { | 257 void* GrProcessorDataManager::operator new(size_t size) { |
| 248 return MemoryPoolAccessor().pool()->allocate(size); | 258 return MemoryPoolAccessor().pool()->allocate(size); |
| 249 } | 259 } |
| 250 | 260 |
| 251 void GrProcessorDataManager::operator delete(void* target) { | 261 void GrProcessorDataManager::operator delete(void* target) { |
| 252 return MemoryPoolAccessor().pool()->release(target); | 262 return MemoryPoolAccessor().pool()->release(target); |
| 253 } | 263 } |
| OLD | NEW |