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

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: 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->setUnknown();
177 } else {
178 out->setKnownComponents(fColor);
179 }
180 out->setHasFourComponents();
181 this->onComputeOutputColor(out);
182 }
175 183
184 void GrGeometryProcessor::computeOutputCoverage(GrInitInvariantOutput* out) cons t {
185 out->fValidFlags = kRGBA_GrColorComponentFlags;
186 out->fColor = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverage);
187 out->setIsSingleComponent();
188 if (fHasVertexCoverage) {
189 out->setUnknown();
190 }
191 this->onComputeOutputCoverage(out);
176 } 192 }
177 193
178 //////////////////////////////////////////////////////////////////////////////// /////////////////// 194 //////////////////////////////////////////////////////////////////////////////// ///////////////////
195
196 void GrPathProcessor::computeOutputColor(GrInitInvariantOutput* out) const {
197 out->fValidFlags = kRGBA_GrColorComponentFlags;
198 out->fColor = fColor;
199 out->fIsSingleComponent = false;
200 }
201
202 void GrPathProcessor::computeOutputCoverage(GrInitInvariantOutput* out) const {
203 out->fValidFlags = kRGBA_GrColorComponentFlags;
204 out->fColor = fColor;
205 out->fIsSingleComponent = true;
206 }
207
208 //////////////////////////////////////////////////////////////////////////////// ///////////////////
179 209
180 /* 210 /*
181 * GrGeometryData shares the same pool so it lives in this file too 211 * GrGeometryData shares the same pool so it lives in this file too
182 */ 212 */
183 void* GrGeometryData::operator new(size_t size) { 213 void* GrGeometryData::operator new(size_t size) {
184 return GrProcessor_Globals::GetTLS()->allocate(size); 214 return GrProcessor_Globals::GetTLS()->allocate(size);
185 } 215 }
186 216
187 void GrGeometryData::operator delete(void* target) { 217 void GrGeometryData::operator delete(void* target) {
188 GrProcessor_Globals::GetTLS()->release(target); 218 GrProcessor_Globals::GetTLS()->release(target);
189 } 219 }
190 220
191 //////////////////////////////////////////////////////////////////////////////// /////////////////// 221 //////////////////////////////////////////////////////////////////////////////// ///////////////////
192 222
193 // Initial static variable from GrXPFactory 223 // Initial static variable from GrXPFactory
194 int32_t GrXPFactory::gCurrXPFClassID = 224 int32_t GrXPFactory::gCurrXPFClassID =
195 GrXPFactory::kIllegalXPFClassID; 225 GrXPFactory::kIllegalXPFClassID;
196 226
227 //////////////////////////////////////////////////////////////////////////////// ///////////////////
228
229 void GrXferProcessor::computeInvariantOutput(GrInvariantOutput* inout) const {
230 this->onComputeInvariantOutput(inout);
231 }
232
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698