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

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

Issue 1261083003: Use new API everywhere for GrDefaultGeoProcFactory (Closed) Base URL: https://skia.googlesource.com/skia.git@lccleanup2
Patch Set: tweaks 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
277 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(const Color& color, 261 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(const Color& color,
278 const Coverage& cover age, 262 const Coverage& cover age,
279 const LocalCoords& lo calCoords, 263 const LocalCoords& lo calCoords,
280 const SkMatrix& viewM atrix) { 264 const SkMatrix& viewM atrix) {
281 uint32_t flags = 0; 265 uint32_t flags = 0;
282 flags |= color.fType == Color::kAttribute_Type ? kColor_GPType : 0; 266 flags |= color.fType == Color::kAttribute_Type ? kColor_GPType : 0;
283 flags |= coverage.fType == Coverage::kAttribute_Type ? kCoverage_GPType : 0; 267 flags |= coverage.fType == Coverage::kAttribute_Type ? kCoverage_GPType : 0;
284 flags |= localCoords.fType == LocalCoords::kHasExplicit_Type ? kLocalCoord_G PType : 0; 268 flags |= localCoords.fType == LocalCoords::kHasExplicit_Type ? kLocalCoord_G PType : 0;
285 269
286 uint8_t inCoverage = coverage.fCoverage; 270 uint8_t inCoverage = coverage.fCoverage;
287 bool coverageWillBeIgnored = coverage.fType == Coverage::kNone_Type; 271 bool coverageWillBeIgnored = coverage.fType == Coverage::kNone_Type;
288 bool localCoordsWillBeRead = localCoords.fType != LocalCoords::kUnused_Type; 272 bool localCoordsWillBeRead = localCoords.fType != LocalCoords::kUnused_Type;
289 273
290 GrColor inColor = color.fColor; 274 GrColor inColor = color.fColor;
291 return DefaultGeoProc::Create(flags, 275 return DefaultGeoProc::Create(flags,
292 inColor, 276 inColor,
293 viewMatrix, 277 viewMatrix,
294 localCoords.fMatrix ? *localCoords.fMatrix : S kMatrix::I(), 278 localCoords.fMatrix ? *localCoords.fMatrix : S kMatrix::I(),
295 localCoordsWillBeRead, 279 localCoordsWillBeRead,
296 coverageWillBeIgnored, 280 coverageWillBeIgnored,
297 inCoverage); 281 inCoverage);
298 } 282 }
299 283
300 const GrGeometryProcessor* GrDefaultGeoProcFactory::CreateForDeviceSpace( 284 const GrGeometryProcessor* GrDefaultGeoProcFactory::CreateForDeviceSpace(
301 const Color & color, 285 const Color & color,
302 const Cover age& coverage, 286 const Cover age& coverage,
303 const Local Coords& localCoords, 287 const Local Coords& localCoords,
304 const SkMat rix& viewMatrix) { 288 const SkMat rix& viewMatrix) {
305 SkASSERT(LocalCoords::kUsePosition_Type == localCoords.fType);
306 SkMatrix invert = SkMatrix::I(); 289 SkMatrix invert = SkMatrix::I();
307 if (!viewMatrix.isIdentity() && !viewMatrix.invert(&invert)) { 290 if (LocalCoords::kUnused_Type != localCoords.fType) {
308 SkDebugf("Could not invert\n"); 291 SkASSERT(LocalCoords::kUsePosition_Type == localCoords.fType);
309 return NULL; 292 if (!viewMatrix.isIdentity() && !viewMatrix.invert(&invert)) {
310 } 293 SkDebugf("Could not invert\n");
294 return NULL;
295 }
311 296
312 if (localCoords.hasLocalMatrix()) { 297 if (localCoords.hasLocalMatrix()) {
313 invert.preConcat(*localCoords.fMatrix); 298 invert.preConcat(*localCoords.fMatrix);
299 }
314 } 300 }
315 301
316 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert); 302 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert);
317 return Create(color, coverage, inverted); 303 return Create(color, coverage, inverted, SkMatrix::I());
318 } 304 }
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