Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: src/gpu/GrProcessor.cpp

Issue 1287023009: Added tree structure to GrGLFragmentProcessor, i.e. GL instances (Closed) Base URL: https://skia.googlesource.com/skia@cs3_isequal_nonrecursive
Patch Set: moved onSetData from public to protected, onCreateGLInstance from public to private in subclasses Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "GrGeometryProcessor.h" 11 #include "GrGeometryProcessor.h"
12 #include "GrInvariantOutput.h" 12 #include "GrInvariantOutput.h"
13 #include "GrMemoryPool.h" 13 #include "GrMemoryPool.h"
14 #include "GrXferProcessor.h" 14 #include "GrXferProcessor.h"
15 #include "SkSpinlock.h" 15 #include "SkSpinlock.h"
16 #include "gl/GrGLFragmentProcessor.h"
16 17
17 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 18 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
18 19
19 class GrFragmentProcessor; 20 class GrFragmentProcessor;
20 class GrGeometryProcessor; 21 class GrGeometryProcessor;
21 22
22 /* 23 /*
23 * Originally these were both in the processor unit test header, but then it see med to cause linker 24 * Originally these were both in the processor unit test header, but then it see med to cause linker
24 * problems on android. 25 * problems on android.
25 */ 26 */
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return false; 150 return false;
150 } 151 }
151 for (int i = 0; i < this->numChildProcessors(); ++i) { 152 for (int i = 0; i < this->numChildProcessors(); ++i) {
152 if (!this->childProcessor(i).isEqual(that.childProcessor(i), ignoreCoord Transforms)) { 153 if (!this->childProcessor(i).isEqual(that.childProcessor(i), ignoreCoord Transforms)) {
153 return false; 154 return false;
154 } 155 }
155 } 156 }
156 return true; 157 return true;
157 } 158 }
158 159
160 GrGLFragmentProcessor* GrFragmentProcessor::createGLInstance() const {
161 GrGLFragmentProcessor* glFragProc = this->onCreateGLInstance();
162 glFragProc->fChildProcessors.push_back_n(fChildProcessors.count());
163 for (int i = 0; i < fChildProcessors.count(); ++i) {
164 glFragProc->fChildProcessors[i] = fChildProcessors[i].processor()->creat eGLInstance();
165 }
166 return glFragProc;
167 }
168
159 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { 169 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) {
160 fCoordTransforms.push_back(transform); 170 fCoordTransforms.push_back(transform);
161 fUsesLocalCoords = fUsesLocalCoords || transform->sourceCoords() == kLocal_G rCoordSet; 171 fUsesLocalCoords = fUsesLocalCoords || transform->sourceCoords() == kLocal_G rCoordSet;
162 SkDEBUGCODE(transform->setInProcessor();) 172 SkDEBUGCODE(transform->setInProcessor();)
163 } 173 }
164 174
165 int GrFragmentProcessor::registerChildProcessor(const GrFragmentProcessor* child ) { 175 int GrFragmentProcessor::registerChildProcessor(const GrFragmentProcessor* child ) {
166 // Append the child's transforms to our transforms array and the child's tex tures array to our 176 // Append the child's transforms to our transforms array and the child's tex tures array to our
167 // textures array 177 // textures array
168 if (!child->fCoordTransforms.empty()) { 178 if (!child->fCoordTransforms.empty()) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 //////////////////////////////////////////////////////////////////////////////// /////////////////// 220 //////////////////////////////////////////////////////////////////////////////// ///////////////////
211 221
212 // GrProcessorDataManager lives in the same pool 222 // GrProcessorDataManager lives in the same pool
213 void* GrProcessorDataManager::operator new(size_t size) { 223 void* GrProcessorDataManager::operator new(size_t size) {
214 return MemoryPoolAccessor().pool()->allocate(size); 224 return MemoryPoolAccessor().pool()->allocate(size);
215 } 225 }
216 226
217 void GrProcessorDataManager::operator delete(void* target) { 227 void GrProcessorDataManager::operator delete(void* target) {
218 return MemoryPoolAccessor().pool()->release(target); 228 return MemoryPoolAccessor().pool()->release(target);
219 } 229 }
OLDNEW
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/effects/GrBicubicEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698