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

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

Issue 791743003: Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: cleanup Created 6 years 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"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::computeOutputColor(GrInitInvariantOutput* out) const {
175 if (fHasVertexColor) {
176 out->setIsUnknownFourComponents();
177 } else {
178 out->setIsKnownFourComponents(fColor);
179 }
180 this->onComputeOutputColor(out);
181 }
175 182
183 void GrGeometryProcessor::computeOutputCoverage(GrInitInvariantOutput* out) cons t {
184 this->onComputeOutputCoverage(out);
176 } 185 }
177 186
178 //////////////////////////////////////////////////////////////////////////////// /////////////////// 187 //////////////////////////////////////////////////////////////////////////////// ///////////////////
188
189 void GrPathProcessor::computeOutputColor(GrInitInvariantOutput* out) const {
190 out->setIsKnownFourComponents(fColor);
191 }
192
193 void GrPathProcessor::computeOutputCoverage(GrInitInvariantOutput* out) const {
194 out->setIsKnownSingleComponent(0xff);
195 out->fValidFlags = kRGBA_GrColorComponentFlags;
196 out->fColor = GrColor_WHITE;
197 //out->setIsSingleComponent();
bsalomon 2014/12/10 15:27:00 why commented out? why calling helper and setting
198 }
199
200 //////////////////////////////////////////////////////////////////////////////// ///////////////////
179 201
180 /* 202 /*
181 * GrGeometryData shares the same pool so it lives in this file too 203 * GrGeometryData shares the same pool so it lives in this file too
182 */ 204 */
183 void* GrGeometryData::operator new(size_t size) { 205 void* GrGeometryData::operator new(size_t size) {
184 return GrProcessor_Globals::GetTLS()->allocate(size); 206 return GrProcessor_Globals::GetTLS()->allocate(size);
185 } 207 }
186 208
187 void GrGeometryData::operator delete(void* target) { 209 void GrGeometryData::operator delete(void* target) {
188 GrProcessor_Globals::GetTLS()->release(target); 210 GrProcessor_Globals::GetTLS()->release(target);
189 } 211 }
190 212
191 //////////////////////////////////////////////////////////////////////////////// /////////////////// 213 //////////////////////////////////////////////////////////////////////////////// ///////////////////
192 214
193 // Initial static variable from GrXPFactory 215 // Initial static variable from GrXPFactory
194 int32_t GrXPFactory::gCurrXPFClassID = 216 int32_t GrXPFactory::gCurrXPFClassID =
195 GrXPFactory::kIllegalXPFClassID; 217 GrXPFactory::kIllegalXPFClassID;
196 218
219 //////////////////////////////////////////////////////////////////////////////// ///////////////////
220
221 void GrXferProcessor::computeInvariantOutput(GrInvariantOutput* inout) const {
222 this->onComputeInvariantOutput(inout);
223 }
224
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698