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

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

Issue 1962243002: Separate user and raw stencil settings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comments Created 4 years, 7 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 437 }
438 438
439 const bool isHairline = stroke->isHairlineStyle(); 439 const bool isHairline = stroke->isHairlineStyle();
440 440
441 // Save the current xp on the draw state so we can reset it if needed 441 // Save the current xp on the draw state so we can reset it if needed
442 const GrXPFactory* xpFactory = pipelineBuilder->getXPFactory(); 442 const GrXPFactory* xpFactory = pipelineBuilder->getXPFactory();
443 SkAutoTUnref<const GrXPFactory> backupXPFactory(SkSafeRef(xpFactory)); 443 SkAutoTUnref<const GrXPFactory> backupXPFactory(SkSafeRef(xpFactory));
444 // face culling doesn't make sense here 444 // face culling doesn't make sense here
445 SkASSERT(GrPipelineBuilder::kBoth_DrawFace == pipelineBuilder->getDrawFace() ); 445 SkASSERT(GrPipelineBuilder::kBoth_DrawFace == pipelineBuilder->getDrawFace() );
446 446
447 int passCount = 0; 447 int passCount = 0;
448 const GrStencilSettings* passes[3]; 448 const GrUserStencilSettings* passes[3];
449 GrPipelineBuilder::DrawFace drawFace[3]; 449 GrPipelineBuilder::DrawFace drawFace[3];
450 bool reverse = false; 450 bool reverse = false;
451 bool lastPassIsBounds; 451 bool lastPassIsBounds;
452 452
453 if (isHairline) { 453 if (isHairline) {
454 passCount = 1; 454 passCount = 1;
455 if (stencilOnly) { 455 if (stencilOnly) {
456 passes[0] = &gDirectToStencil; 456 passes[0] = &gDirectToStencil;
457 } else { 457 } else {
458 passes[0] = nullptr; 458 passes[0] = nullptr;
459 } 459 }
460 lastPassIsBounds = false; 460 lastPassIsBounds = false;
461 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; 461 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 538
539 SkScalar tol = GrPathUtils::kDefaultTolerance; 539 SkScalar tol = GrPathUtils::kDefaultTolerance;
540 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, pat h.getBounds()); 540 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, pat h.getBounds());
541 541
542 SkRect devBounds; 542 SkRect devBounds;
543 GetPathDevBounds(path, pipelineBuilder->getRenderTarget(), viewMatrix, &devB ounds); 543 GetPathDevBounds(path, pipelineBuilder->getRenderTarget(), viewMatrix, &devB ounds);
544 544
545 for (int p = 0; p < passCount; ++p) { 545 for (int p = 0; p < passCount; ++p) {
546 pipelineBuilder->setDrawFace(drawFace[p]); 546 pipelineBuilder->setDrawFace(drawFace[p]);
547 if (passes[p]) { 547 if (passes[p]) {
548 *pipelineBuilder->stencil() = *passes[p]; 548 pipelineBuilder->setUserStencil(passes[p]);
549 } 549 }
550 550
551 if (lastPassIsBounds && (p == passCount-1)) { 551 if (lastPassIsBounds && (p == passCount-1)) {
552 // Reset the XP Factory on pipelineBuilder 552 // Reset the XP Factory on pipelineBuilder
553 pipelineBuilder->setXPFactory(backupXPFactory); 553 pipelineBuilder->setXPFactory(backupXPFactory);
554 SkRect bounds; 554 SkRect bounds;
555 SkMatrix localMatrix = SkMatrix::I(); 555 SkMatrix localMatrix = SkMatrix::I();
556 if (reverse) { 556 if (reverse) {
557 SkASSERT(pipelineBuilder->getRenderTarget()); 557 SkASSERT(pipelineBuilder->getRenderTarget());
558 // draw over the dev bounds (which will be the whole dst surface for inv fill). 558 // draw over the dev bounds (which will be the whole dst surface for inv fill).
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 geometry.fColor = color; 643 geometry.fColor = color;
644 geometry.fPath = path; 644 geometry.fPath = path;
645 geometry.fTolerance = srcSpaceTol; 645 geometry.fTolerance = srcSpaceTol;
646 646
647 viewMatrix.mapRect(&bounds); 647 viewMatrix.mapRect(&bounds);
648 uint8_t coverage = GrRandomCoverage(random); 648 uint8_t coverage = GrRandomCoverage(random);
649 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds ); 649 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds );
650 } 650 }
651 651
652 #endif 652 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698