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

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

Issue 1264283004: Revert of Use new API everywhere for GrDefaultGeoProcFactory (Closed) Base URL: https://skia.googlesource.com/skia.git@lccleanup2
Patch Set: 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
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.h ('k') | src/gpu/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "GrDefaultGeoProcFactory.h" 8 #include "GrDefaultGeoProcFactory.h"
9 9
10 #include "GrInvariantOutput.h" 10 #include "GrInvariantOutput.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 return DefaultGeoProc::Create(flags, 252 return DefaultGeoProc::Create(flags,
253 GrRandomColor(d->fRandom), 253 GrRandomColor(d->fRandom),
254 GrTest::TestMatrix(d->fRandom), 254 GrTest::TestMatrix(d->fRandom),
255 GrTest::TestMatrix(d->fRandom), 255 GrTest::TestMatrix(d->fRandom),
256 d->fRandom->nextBool(), 256 d->fRandom->nextBool(),
257 d->fRandom->nextBool(), 257 d->fRandom->nextBool(),
258 GrRandomCoverage(d->fRandom)); 258 GrRandomCoverage(d->fRandom));
259 } 259 }
260 260
261 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(uint32_t gpTypeFlags,
262 GrColor color,
263 bool localCoordsWillB eRead,
264 bool coverageWillBeIg nored,
265 const SkMatrix& viewM atrix,
266 const SkMatrix& local Matrix,
267 uint8_t coverage) {
268 return DefaultGeoProc::Create(gpTypeFlags,
269 color,
270 viewMatrix,
271 localMatrix,
272 localCoordsWillBeRead,
273 coverageWillBeIgnored,
274 coverage);
275 }
276
261 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(const Color& color, 277 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(const Color& color,
262 const Coverage& cover age, 278 const Coverage& cover age,
263 const LocalCoords& lo calCoords, 279 const LocalCoords& lo calCoords,
264 const SkMatrix& viewM atrix) { 280 const SkMatrix& viewM atrix) {
265 uint32_t flags = 0; 281 uint32_t flags = 0;
266 flags |= color.fType == Color::kAttribute_Type ? kColor_GPType : 0; 282 flags |= color.fType == Color::kAttribute_Type ? kColor_GPType : 0;
267 flags |= coverage.fType == Coverage::kAttribute_Type ? kCoverage_GPType : 0; 283 flags |= coverage.fType == Coverage::kAttribute_Type ? kCoverage_GPType : 0;
268 flags |= localCoords.fType == LocalCoords::kHasExplicit_Type ? kLocalCoord_G PType : 0; 284 flags |= localCoords.fType == LocalCoords::kHasExplicit_Type ? kLocalCoord_G PType : 0;
269 285
270 uint8_t inCoverage = coverage.fCoverage; 286 uint8_t inCoverage = coverage.fCoverage;
271 bool coverageWillBeIgnored = coverage.fType == Coverage::kNone_Type; 287 bool coverageWillBeIgnored = coverage.fType == Coverage::kNone_Type;
272 bool localCoordsWillBeRead = localCoords.fType != LocalCoords::kUnused_Type; 288 bool localCoordsWillBeRead = localCoords.fType != LocalCoords::kUnused_Type;
273 289
274 GrColor inColor = color.fColor; 290 GrColor inColor = color.fColor;
275 return DefaultGeoProc::Create(flags, 291 return DefaultGeoProc::Create(flags,
276 inColor, 292 inColor,
277 viewMatrix, 293 viewMatrix,
278 localCoords.fMatrix ? *localCoords.fMatrix : S kMatrix::I(), 294 localCoords.fMatrix ? *localCoords.fMatrix : S kMatrix::I(),
279 localCoordsWillBeRead, 295 localCoordsWillBeRead,
280 coverageWillBeIgnored, 296 coverageWillBeIgnored,
281 inCoverage); 297 inCoverage);
282 } 298 }
283 299
284 const GrGeometryProcessor* GrDefaultGeoProcFactory::CreateForDeviceSpace( 300 const GrGeometryProcessor* GrDefaultGeoProcFactory::CreateForDeviceSpace(
285 const Color & color, 301 const Color & color,
286 const Cover age& coverage, 302 const Cover age& coverage,
287 const Local Coords& localCoords, 303 const Local Coords& localCoords,
288 const SkMat rix& viewMatrix) { 304 const SkMat rix& viewMatrix) {
305 SkASSERT(LocalCoords::kUsePosition_Type == localCoords.fType);
289 SkMatrix invert = SkMatrix::I(); 306 SkMatrix invert = SkMatrix::I();
290 if (LocalCoords::kUnused_Type != localCoords.fType) { 307 if (!viewMatrix.isIdentity() && !viewMatrix.invert(&invert)) {
291 SkASSERT(LocalCoords::kUsePosition_Type == localCoords.fType); 308 SkDebugf("Could not invert\n");
292 if (!viewMatrix.isIdentity() && !viewMatrix.invert(&invert)) { 309 return NULL;
293 SkDebugf("Could not invert\n"); 310 }
294 return NULL;
295 }
296 311
297 if (localCoords.hasLocalMatrix()) { 312 if (localCoords.hasLocalMatrix()) {
298 invert.preConcat(*localCoords.fMatrix); 313 invert.preConcat(*localCoords.fMatrix);
299 }
300 } 314 }
301 315
302 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert); 316 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert);
303 return Create(color, coverage, inverted, SkMatrix::I()); 317 return Create(color, coverage, inverted);
304 } 318 }
OLDNEW
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.h ('k') | src/gpu/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698