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

Side by Side Diff: src/gpu/batches/GrDefaultPathRenderer.cpp

Issue 2165283002: Remove DrawFace enum from GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: try again Created 4 years, 5 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 2011 Google Inc. 2 * Copyright 2011 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 "GrDefaultPathRenderer.h" 8 #include "GrDefaultPathRenderer.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 bool isHairline = false; 426 bool isHairline = false;
427 if (IsStrokeHairlineOrEquivalent(shape.style(), viewMatrix, &hairlineCoverag e)) { 427 if (IsStrokeHairlineOrEquivalent(shape.style(), viewMatrix, &hairlineCoverag e)) {
428 newCoverage = SkScalarRoundToInt(hairlineCoverage * 0xff); 428 newCoverage = SkScalarRoundToInt(hairlineCoverage * 0xff);
429 isHairline = true; 429 isHairline = true;
430 } else { 430 } else {
431 SkASSERT(shape.style().isSimpleFill()); 431 SkASSERT(shape.style().isSimpleFill());
432 } 432 }
433 433
434 int passCount = 0; 434 int passCount = 0;
435 const GrUserStencilSettings* passes[3]; 435 const GrUserStencilSettings* passes[3];
436 GrPipelineBuilder::DrawFace drawFace[3]; 436 GrDrawFace drawFace[3];
437 bool reverse = false; 437 bool reverse = false;
438 bool lastPassIsBounds; 438 bool lastPassIsBounds;
439 439
440 if (isHairline) { 440 if (isHairline) {
441 passCount = 1; 441 passCount = 1;
442 if (stencilOnly) { 442 if (stencilOnly) {
443 passes[0] = &gDirectToStencil; 443 passes[0] = &gDirectToStencil;
444 } else { 444 } else {
445 passes[0] = userStencilSettings; 445 passes[0] = userStencilSettings;
446 } 446 }
447 lastPassIsBounds = false; 447 lastPassIsBounds = false;
448 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; 448 drawFace[0] = GrDrawFace::kBoth;
449 } else { 449 } else {
450 if (single_pass_shape(shape)) { 450 if (single_pass_shape(shape)) {
451 passCount = 1; 451 passCount = 1;
452 if (stencilOnly) { 452 if (stencilOnly) {
453 passes[0] = &gDirectToStencil; 453 passes[0] = &gDirectToStencil;
454 } else { 454 } else {
455 passes[0] = userStencilSettings; 455 passes[0] = userStencilSettings;
456 } 456 }
457 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; 457 drawFace[0] = GrDrawFace::kBoth;
458 lastPassIsBounds = false; 458 lastPassIsBounds = false;
459 } else { 459 } else {
460 switch (path.getFillType()) { 460 switch (path.getFillType()) {
461 case SkPath::kInverseEvenOdd_FillType: 461 case SkPath::kInverseEvenOdd_FillType:
462 reverse = true; 462 reverse = true;
463 // fallthrough 463 // fallthrough
464 case SkPath::kEvenOdd_FillType: 464 case SkPath::kEvenOdd_FillType:
465 passes[0] = &gEOStencilPass; 465 passes[0] = &gEOStencilPass;
466 if (stencilOnly) { 466 if (stencilOnly) {
467 passCount = 1; 467 passCount = 1;
468 lastPassIsBounds = false; 468 lastPassIsBounds = false;
469 } else { 469 } else {
470 passCount = 2; 470 passCount = 2;
471 lastPassIsBounds = true; 471 lastPassIsBounds = true;
472 if (reverse) { 472 if (reverse) {
473 passes[1] = &gInvEOColorPass; 473 passes[1] = &gInvEOColorPass;
474 } else { 474 } else {
475 passes[1] = &gEOColorPass; 475 passes[1] = &gEOColorPass;
476 } 476 }
477 } 477 }
478 drawFace[0] = drawFace[1] = GrPipelineBuilder::kBoth_DrawFac e; 478 drawFace[0] = drawFace[1] = GrDrawFace::kBoth;
479 break; 479 break;
480 480
481 case SkPath::kInverseWinding_FillType: 481 case SkPath::kInverseWinding_FillType:
482 reverse = true; 482 reverse = true;
483 // fallthrough 483 // fallthrough
484 case SkPath::kWinding_FillType: 484 case SkPath::kWinding_FillType:
485 if (fSeparateStencil) { 485 if (fSeparateStencil) {
486 if (fStencilWrapOps) { 486 if (fStencilWrapOps) {
487 passes[0] = &gWindStencilSeparateWithWrap; 487 passes[0] = &gWindStencilSeparateWithWrap;
488 } else { 488 } else {
489 passes[0] = &gWindStencilSeparateNoWrap; 489 passes[0] = &gWindStencilSeparateNoWrap;
490 } 490 }
491 passCount = 2; 491 passCount = 2;
492 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; 492 drawFace[0] = GrDrawFace::kBoth;
493 } else { 493 } else {
494 if (fStencilWrapOps) { 494 if (fStencilWrapOps) {
495 passes[0] = &gWindSingleStencilWithWrapInc; 495 passes[0] = &gWindSingleStencilWithWrapInc;
496 passes[1] = &gWindSingleStencilWithWrapDec; 496 passes[1] = &gWindSingleStencilWithWrapDec;
497 } else { 497 } else {
498 passes[0] = &gWindSingleStencilNoWrapInc; 498 passes[0] = &gWindSingleStencilNoWrapInc;
499 passes[1] = &gWindSingleStencilNoWrapDec; 499 passes[1] = &gWindSingleStencilNoWrapDec;
500 } 500 }
501 // which is cw and which is ccw is arbitrary. 501 // which is cw and which is ccw is arbitrary.
502 drawFace[0] = GrPipelineBuilder::kCW_DrawFace; 502 drawFace[0] = GrDrawFace::kCW;
503 drawFace[1] = GrPipelineBuilder::kCCW_DrawFace; 503 drawFace[1] = GrDrawFace::kCCW;
504 passCount = 3; 504 passCount = 3;
505 } 505 }
506 if (stencilOnly) { 506 if (stencilOnly) {
507 lastPassIsBounds = false; 507 lastPassIsBounds = false;
508 --passCount; 508 --passCount;
509 } else { 509 } else {
510 lastPassIsBounds = true; 510 lastPassIsBounds = true;
511 drawFace[passCount-1] = GrPipelineBuilder::kBoth_DrawFac e; 511 drawFace[passCount-1] = GrDrawFace::kBoth;
512 if (reverse) { 512 if (reverse) {
513 passes[passCount-1] = &gInvWindColorPass; 513 passes[passCount-1] = &gInvWindColorPass;
514 } else { 514 } else {
515 passes[passCount-1] = &gWindColorPass; 515 passes[passCount-1] = &gWindColorPass;
516 } 516 }
517 } 517 }
518 break; 518 break;
519 default: 519 default:
520 SkDEBUGFAIL("Unknown path fFill!"); 520 SkDEBUGFAIL("Unknown path fFill!");
521 return false; 521 return false;
(...skipping 25 matching lines...) Expand all
547 } 547 }
548 } else { 548 } else {
549 bounds = path.getBounds(); 549 bounds = path.getBounds();
550 } 550 }
551 const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? S kMatrix::I() : 551 const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? S kMatrix::I() :
552 v iewMatrix; 552 v iewMatrix;
553 SkAutoTUnref<GrDrawBatch> batch( 553 SkAutoTUnref<GrDrawBatch> batch(
554 GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr, 554 GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr,
555 &localMatrix)); 555 &localMatrix));
556 556
557 SkASSERT(GrPipelineBuilder::kBoth_DrawFace == drawFace[p]); 557 SkASSERT(GrDrawFace::kBoth == drawFace[p]);
558 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(pa int)); 558 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(pa int));
559 pipelineBuilder.setDrawFace(drawFace[p]); 559 pipelineBuilder.setDrawFace(drawFace[p]);
560 pipelineBuilder.setUserStencil(passes[p]); 560 pipelineBuilder.setUserStencil(passes[p]);
561 561
562 drawContext->drawBatch(pipelineBuilder, clip, batch); 562 drawContext->drawBatch(pipelineBuilder, clip, batch);
563 } else { 563 } else {
564 SkAutoTUnref<GrDrawBatch> batch(new DefaultPathBatch(paint.getColor( ), path, 564 SkAutoTUnref<GrDrawBatch> batch(new DefaultPathBatch(paint.getColor( ), path,
565 srcSpaceTol, 565 srcSpaceTol,
566 newCoverage, vi ewMatrix, 566 newCoverage, vi ewMatrix,
567 isHairline, dev Bounds)); 567 isHairline, dev Bounds));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 SkRect bounds = path.getBounds(); 628 SkRect bounds = path.getBounds();
629 SkScalar tol = GrPathUtils::kDefaultTolerance; 629 SkScalar tol = GrPathUtils::kDefaultTolerance;
630 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, bou nds); 630 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, bou nds);
631 631
632 viewMatrix.mapRect(&bounds); 632 viewMatrix.mapRect(&bounds);
633 uint8_t coverage = GrRandomCoverage(random); 633 uint8_t coverage = GrRandomCoverage(random);
634 return new DefaultPathBatch(color, path, srcSpaceTol, coverage, viewMatrix, true, bounds); 634 return new DefaultPathBatch(color, path, srcSpaceTol, coverage, viewMatrix, true, bounds);
635 } 635 }
636 636
637 #endif 637 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrDashLinePathRenderer.cpp ('k') | src/gpu/batches/GrStencilAndCoverPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698