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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 for (int i = 0; i < this->numTextures(); ++i) { | 122 for (int i = 0; i < this->numTextures(); ++i) { |
123 if (this->textureAccess(i) != that.textureAccess(i)) { | 123 if (this->textureAccess(i) != that.textureAccess(i)) { |
124 return false; | 124 return false; |
125 } | 125 } |
126 } | 126 } |
127 return true; | 127 return true; |
128 } | 128 } |
129 | 129 |
130 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 130 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
131 | 131 |
| 132 bool GrFragmentProcessor::isEqual(const GrFragmentProcessor& that, |
| 133 bool ignoreCoordTransforms) const { |
| 134 if (this->classID() != that.classID() || |
| 135 !this->hasSameTextureAccesses(that)) { |
| 136 return false; |
| 137 } |
| 138 if (ignoreCoordTransforms) { |
| 139 if (this->numTransforms() != that.numTransforms()) { |
| 140 return false; |
| 141 } |
| 142 } else if (!this->hasSameTransforms(that)) { |
| 143 return false; |
| 144 } |
| 145 if (!this->onIsEqual(that)) { |
| 146 return false; |
| 147 } |
| 148 if (this->numChildProcessors() != that.numChildProcessors()) { |
| 149 return false; |
| 150 } |
| 151 for (int i = 0; i < this->numChildProcessors(); ++i) { |
| 152 if (!this->childProcessor(i).isEqual(that.childProcessor(i), ignoreCoord
Transforms)) { |
| 153 return false; |
| 154 } |
| 155 } |
| 156 return true; |
| 157 } |
| 158 |
132 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { | 159 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { |
133 fCoordTransforms.push_back(transform); | 160 fCoordTransforms.push_back(transform); |
134 fUsesLocalCoords = fUsesLocalCoords || transform->sourceCoords() == kLocal_G
rCoordSet; | 161 fUsesLocalCoords = fUsesLocalCoords || transform->sourceCoords() == kLocal_G
rCoordSet; |
135 SkDEBUGCODE(transform->setInProcessor();) | 162 SkDEBUGCODE(transform->setInProcessor();) |
136 } | 163 } |
137 | 164 |
138 int GrFragmentProcessor::registerChildProcessor(const GrFragmentProcessor* child
) { | 165 int GrFragmentProcessor::registerChildProcessor(const GrFragmentProcessor* child
) { |
139 // Append the child's transforms to our transforms array and the child's tex
tures array to our | 166 // Append the child's transforms to our transforms array and the child's tex
tures array to our |
140 // textures array | 167 // textures array |
141 if (!child->fCoordTransforms.empty()) { | 168 if (!child->fCoordTransforms.empty()) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 210 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
184 | 211 |
185 // GrProcessorDataManager lives in the same pool | 212 // GrProcessorDataManager lives in the same pool |
186 void* GrProcessorDataManager::operator new(size_t size) { | 213 void* GrProcessorDataManager::operator new(size_t size) { |
187 return MemoryPoolAccessor().pool()->allocate(size); | 214 return MemoryPoolAccessor().pool()->allocate(size); |
188 } | 215 } |
189 | 216 |
190 void GrProcessorDataManager::operator delete(void* target) { | 217 void GrProcessorDataManager::operator delete(void* target) { |
191 return MemoryPoolAccessor().pool()->release(target); | 218 return MemoryPoolAccessor().pool()->release(target); |
192 } | 219 } |
OLD | NEW |