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

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

Issue 815553003: Move ViewMatrix off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@remove-fragment-stage
Patch Set: more cleaning Created 5 years, 11 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/GrAAConvexPathRenderer.h ('k') | src/gpu/GrAADistanceFieldPathRenderer.h » ('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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrAAConvexPathRenderer.h" 9 #include "GrAAConvexPathRenderer.h"
10 10
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 const BatchTracker& mine = m.cast<BatchTracker>(); 620 const BatchTracker& mine = m.cast<BatchTracker>();
621 const BatchTracker& theirs = t.cast<BatchTracker>(); 621 const BatchTracker& theirs = t.cast<BatchTracker>();
622 return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords, 622 return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
623 that, theirs.fUsesLocalCoords) && 623 that, theirs.fUsesLocalCoords) &&
624 CanCombineOutput(mine.fInputColorType, mine.fColor, 624 CanCombineOutput(mine.fInputColorType, mine.fColor,
625 theirs.fInputColorType, theirs.fColor); 625 theirs.fInputColorType, theirs.fColor);
626 } 626 }
627 627
628 private: 628 private:
629 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix) 629 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix)
630 : INHERITED(color, false, localMatrix) { 630 : INHERITED(color, SkMatrix::I(), localMatrix) {
631 this->initClassID<QuadEdgeEffect>(); 631 this->initClassID<QuadEdgeEffect>();
632 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_Gr VertexAttribType)); 632 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_Gr VertexAttribType));
633 fInQuadEdge = &this->addVertexAttrib(GrAttribute("inQuadEdge", kVec4f_Gr VertexAttribType)); 633 fInQuadEdge = &this->addVertexAttrib(GrAttribute("inQuadEdge", kVec4f_Gr VertexAttribType));
634 } 634 }
635 635
636 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { 636 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE {
637 return true; 637 return true;
638 } 638 }
639 639
640 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRIDE { 640 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRIDE {
(...skipping 23 matching lines...) Expand all
664 // Doesn't work without derivative instructions. 664 // Doesn't work without derivative instructions.
665 return caps.shaderDerivativeSupport() ? 665 return caps.shaderDerivativeSupport() ?
666 QuadEdgeEffect::Create(GrRandomColor(random), 666 QuadEdgeEffect::Create(GrRandomColor(random),
667 GrProcessorUnitTest::TestMatrix(random)) : NUL L; 667 GrProcessorUnitTest::TestMatrix(random)) : NUL L;
668 } 668 }
669 669
670 /////////////////////////////////////////////////////////////////////////////// 670 ///////////////////////////////////////////////////////////////////////////////
671 671
672 bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target, 672 bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target,
673 const GrDrawState*, 673 const GrDrawState*,
674 const SkMatrix& viewMatrix,
674 const SkPath& path, 675 const SkPath& path,
675 const SkStrokeRec& stroke, 676 const SkStrokeRec& stroke,
676 bool antiAlias) const { 677 bool antiAlias) const {
677 return (target->caps()->shaderDerivativeSupport() && antiAlias && 678 return (target->caps()->shaderDerivativeSupport() && antiAlias &&
678 stroke.isFillStyle() && !path.isInverseFillType() && path.isConvex() ); 679 stroke.isFillStyle() && !path.isInverseFillType() && path.isConvex() );
679 } 680 }
680 681
681 bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target, 682 bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target,
682 GrDrawState* drawState, 683 GrDrawState* drawState,
683 GrColor color, 684 GrColor color,
685 const SkMatrix& vm,
684 const SkPath& origPath, 686 const SkPath& origPath,
685 const SkStrokeRec&, 687 const SkStrokeRec&,
686 bool antiAlias) { 688 bool antiAlias) {
687 689
688 const SkPath* path = &origPath; 690 const SkPath* path = &origPath;
689 if (path->isEmpty()) { 691 if (path->isEmpty()) {
690 return true; 692 return true;
691 } 693 }
692 694
693 SkMatrix viewMatrix = drawState->getViewMatrix(); 695 SkMatrix viewMatrix = vm;
694 SkMatrix invert; 696 SkMatrix invert;
695 if (!viewMatrix.invert(&invert)) { 697 if (!viewMatrix.invert(&invert)) {
696 return false; 698 return false;
697 } 699 }
698 700
699 GrDrawState::AutoViewMatrixRestore avmr(drawState);
700
701 // We use the fact that SkPath::transform path does subdivision based on 701 // We use the fact that SkPath::transform path does subdivision based on
702 // perspective. Otherwise, we apply the view matrix when copying to the 702 // perspective. Otherwise, we apply the view matrix when copying to the
703 // segment representation. 703 // segment representation.
704 SkPath tmpPath; 704 SkPath tmpPath;
705 if (viewMatrix.hasPerspective()) { 705 if (viewMatrix.hasPerspective()) {
706 origPath.transform(viewMatrix, &tmpPath); 706 origPath.transform(viewMatrix, &tmpPath);
707 path = &tmpPath; 707 path = &tmpPath;
708 viewMatrix = SkMatrix::I(); 708 viewMatrix = SkMatrix::I();
709 } 709 }
710 710
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 vOffset, // start vertex 764 vOffset, // start vertex
765 0, // start index 765 0, // start index
766 draw.fVertexCnt, 766 draw.fVertexCnt,
767 draw.fIndexCnt, 767 draw.fIndexCnt,
768 &devBounds); 768 &devBounds);
769 vOffset += draw.fVertexCnt; 769 vOffset += draw.fVertexCnt;
770 } 770 }
771 771
772 return true; 772 return true;
773 } 773 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.h ('k') | src/gpu/GrAADistanceFieldPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698