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

Side by Side Diff: src/gpu/batches/GrMSAAPathRenderer.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 2016 Google Inc. 2 * Copyright 2016 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 "GrMSAAPathRenderer.h" 8 #include "GrMSAAPathRenderer.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 const SkPath& path, 573 const SkPath& path,
574 const GrStrokeInfo& origStroke, 574 const GrStrokeInfo& origStroke,
575 bool stencilOnly) { 575 bool stencilOnly) {
576 SkTCopyOnFirstWrite<GrStrokeInfo> stroke(origStroke); 576 SkTCopyOnFirstWrite<GrStrokeInfo> stroke(origStroke);
577 577
578 const GrXPFactory* xpFactory = pipelineBuilder->getXPFactory(); 578 const GrXPFactory* xpFactory = pipelineBuilder->getXPFactory();
579 SkAutoTUnref<const GrXPFactory> backupXPFactory(SkSafeRef(xpFactory)); 579 SkAutoTUnref<const GrXPFactory> backupXPFactory(SkSafeRef(xpFactory));
580 // face culling doesn't make sense here 580 // face culling doesn't make sense here
581 SkASSERT(GrPipelineBuilder::kBoth_DrawFace == pipelineBuilder->getDrawFace() ); 581 SkASSERT(GrPipelineBuilder::kBoth_DrawFace == pipelineBuilder->getDrawFace() );
582 582
583 int passCount = 0; 583 int passCount = 0;
584 const GrStencilSettings* passes[3]; 584 const GrUserStencilSettings* passes[3];
585 GrPipelineBuilder::DrawFace drawFace[3]; 585 GrPipelineBuilder::DrawFace drawFace[3];
586 bool reverse = false; 586 bool reverse = false;
587 bool lastPassIsBounds; 587 bool lastPassIsBounds;
588 588
589 if (single_pass_path(path, *stroke)) { 589 if (single_pass_path(path, *stroke)) {
590 passCount = 1; 590 passCount = 1;
591 if (stencilOnly) { 591 if (stencilOnly) {
592 passes[0] = &gDirectToStencil; 592 passes[0] = &gDirectToStencil;
593 } else { 593 } else {
594 passes[0] = nullptr; 594 passes[0] = nullptr;
595 } 595 }
596 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; 596 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
597 lastPassIsBounds = false; 597 lastPassIsBounds = false;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 return false; 642 return false;
643 } 643 }
644 } 644 }
645 645
646 SkRect devBounds; 646 SkRect devBounds;
647 GetPathDevBounds(path, pipelineBuilder->getRenderTarget(), viewMatrix, &devB ounds); 647 GetPathDevBounds(path, pipelineBuilder->getRenderTarget(), viewMatrix, &devB ounds);
648 648
649 for (int p = 0; p < passCount; ++p) { 649 for (int p = 0; p < passCount; ++p) {
650 pipelineBuilder->setDrawFace(drawFace[p]); 650 pipelineBuilder->setDrawFace(drawFace[p]);
651 if (passes[p]) { 651 if (passes[p]) {
652 *pipelineBuilder->stencil() = *passes[p]; 652 pipelineBuilder->setUserStencil(passes[p]);
653 } 653 }
654 654
655 if (lastPassIsBounds && (p == passCount-1)) { 655 if (lastPassIsBounds && (p == passCount-1)) {
656 // Reset the XP Factory on pipelineBuilder 656 // Reset the XP Factory on pipelineBuilder
657 pipelineBuilder->setXPFactory(backupXPFactory); 657 pipelineBuilder->setXPFactory(backupXPFactory);
658 SkRect bounds; 658 SkRect bounds;
659 SkMatrix localMatrix = SkMatrix::I(); 659 SkMatrix localMatrix = SkMatrix::I();
660 if (reverse) { 660 if (reverse) {
661 SkASSERT(pipelineBuilder->getRenderTarget()); 661 SkASSERT(pipelineBuilder->getRenderTarget());
662 // draw over the dev bounds (which will be the whole dst surface for inv fill). 662 // draw over the dev bounds (which will be the whole dst surface for inv fill).
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 736
737 void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) { 737 void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) {
738 GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(),"GrMSAAPathRenderer: :onStencilPath"); 738 GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(),"GrMSAAPathRenderer: :onStencilPath");
739 SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType()); 739 SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType());
740 SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType()); 740 SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType());
741 this->internalDrawPath(args.fTarget, args.fPipelineBuilder, GrColor_WHITE, * args.fViewMatrix, 741 this->internalDrawPath(args.fTarget, args.fPipelineBuilder, GrColor_WHITE, * args.fViewMatrix,
742 *args.fPath, GrStrokeInfo::FillInfo(), true); 742 *args.fPath, GrStrokeInfo::FillInfo(), true);
743 } 743 }
744 744
745 //////////////////////////////////////////////////////////////////////////////// /////////////////// 745 //////////////////////////////////////////////////////////////////////////////// ///////////////////
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698