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

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

Issue 944873004: Remove historical assert in AAConvexPathRenderer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 return (target->caps()->shaderDerivativeSupport() && antiAlias && 687 return (target->caps()->shaderDerivativeSupport() && antiAlias &&
688 stroke.isFillStyle() && !path.isInverseFillType() && path.isConvex() ); 688 stroke.isFillStyle() && !path.isInverseFillType() && path.isConvex() );
689 } 689 }
690 690
691 class AAConvexPathBatch : public GrBatch { 691 class AAConvexPathBatch : public GrBatch {
692 public: 692 public:
693 struct Geometry { 693 struct Geometry {
694 GrColor fColor; 694 GrColor fColor;
695 SkMatrix fViewMatrix; 695 SkMatrix fViewMatrix;
696 SkPath fPath; 696 SkPath fPath;
697 SkDEBUGCODE(SkRect fDevBounds;)
698 }; 697 };
699 698
700 static GrBatch* Create(const Geometry& geometry) { 699 static GrBatch* Create(const Geometry& geometry) {
701 return SkNEW_ARGS(AAConvexPathBatch, (geometry)); 700 return SkNEW_ARGS(AAConvexPathBatch, (geometry));
702 } 701 }
703 702
704 const char* name() const SK_OVERRIDE { return "AAConvexBatch"; } 703 const char* name() const SK_OVERRIDE { return "AAConvexBatch"; }
705 704
706 void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE { 705 void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE {
707 // When this is called on a batch, there is only one geometry bundle 706 // When this is called on a batch, there is only one geometry bundle
(...skipping 15 matching lines...) Expand all
723 fBatch.fColorIgnored = init.fColorIgnored; 722 fBatch.fColorIgnored = init.fColorIgnored;
724 fBatch.fColor = fGeoData[0].fColor; 723 fBatch.fColor = fGeoData[0].fColor;
725 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; 724 fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
726 fBatch.fCoverageIgnored = init.fCoverageIgnored; 725 fBatch.fCoverageIgnored = init.fCoverageIgnored;
727 } 726 }
728 727
729 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) SK_OVERRIDE { 728 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) SK_OVERRIDE {
730 int instanceCount = fGeoData.count(); 729 int instanceCount = fGeoData.count();
731 730
732 SkMatrix invert; 731 SkMatrix invert;
733 if (!this->viewMatrix().invert(&invert)) { 732 if (this->usesLocalCoords() && !this->viewMatrix().invert(&invert)) {
734 SkDebugf("Could not invert viewmatrix\n"); 733 SkDebugf("Could not invert viewmatrix\n");
735 return; 734 return;
736 } 735 }
737 736
738 // Setup GrGeometryProcessor 737 // Setup GrGeometryProcessor
739 SkAutoTUnref<GrGeometryProcessor> quadProcessor(QuadEdgeEffect::Create(t his->color(), 738 SkAutoTUnref<GrGeometryProcessor> quadProcessor(QuadEdgeEffect::Create(t his->color(),
740 i nvert)); 739 i nvert));
741 740
742 batchTarget->initDraw(quadProcessor, pipeline); 741 batchTarget->initDraw(quadProcessor, pipeline);
743 742
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 void *indices = batchTarget->indexPool()->makeSpace(indexCount, 790 void *indices = batchTarget->indexPool()->makeSpace(indexCount,
792 &indexBuffer, 791 &indexBuffer,
793 &firstIndex); 792 &firstIndex);
794 793
795 QuadVertex* verts = reinterpret_cast<QuadVertex*>(vertices); 794 QuadVertex* verts = reinterpret_cast<QuadVertex*>(vertices);
796 uint16_t* idxs = reinterpret_cast<uint16_t*>(indices); 795 uint16_t* idxs = reinterpret_cast<uint16_t*>(indices);
797 796
798 SkSTArray<kPreallocDrawCnt, Draw, true> draws; 797 SkSTArray<kPreallocDrawCnt, Draw, true> draws;
799 create_vertices(segments, fanPt, &draws, verts, idxs); 798 create_vertices(segments, fanPt, &draws, verts, idxs);
800 799
801 #ifdef SK_DEBUG
802 // Check devBounds
803 SkRect actualBounds;
804 actualBounds.set(verts[0].fPos, verts[1].fPos);
805 for (int i = 2; i < vertexCount; ++i) {
806 actualBounds.growToInclude(verts[i].fPos.fX, verts[i].fPos.fY);
807 }
808 SkASSERT(args.fDevBounds.contains(actualBounds));
809 #endif
810
811 GrDrawTarget::DrawInfo info; 800 GrDrawTarget::DrawInfo info;
812 info.setVertexBuffer(vertexBuffer); 801 info.setVertexBuffer(vertexBuffer);
813 info.setIndexBuffer(indexBuffer); 802 info.setIndexBuffer(indexBuffer);
814 info.setPrimitiveType(kTriangles_GrPrimitiveType); 803 info.setPrimitiveType(kTriangles_GrPrimitiveType);
815 info.setStartIndex(firstIndex); 804 info.setStartIndex(firstIndex);
816 805
817 int vOffset = 0; 806 int vOffset = 0;
818 for (int i = 0; i < draws.count(); ++i) { 807 for (int i = 0; i < draws.count(); ++i) {
819 const Draw& draw = draws[i]; 808 const Draw& draw = draws[i];
820 info.setStartVertex(vOffset + firstVertex); 809 info.setStartVertex(vOffset + firstVertex);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 // We outset our vertices one pixel and add one more pixel for precision. 868 // We outset our vertices one pixel and add one more pixel for precision.
880 // TODO create tighter bounds when we start reordering. 869 // TODO create tighter bounds when we start reordering.
881 SkRect devRect = path.getBounds(); 870 SkRect devRect = path.getBounds();
882 vm.mapRect(&devRect); 871 vm.mapRect(&devRect);
883 devRect.outset(2, 2); 872 devRect.outset(2, 2);
884 873
885 AAConvexPathBatch::Geometry geometry; 874 AAConvexPathBatch::Geometry geometry;
886 geometry.fColor = color; 875 geometry.fColor = color;
887 geometry.fViewMatrix = vm; 876 geometry.fViewMatrix = vm;
888 geometry.fPath = path; 877 geometry.fPath = path;
889 SkDEBUGCODE(geometry.fDevBounds = devRect;)
890 878
891 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry)); 879 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry));
892 target->drawBatch(pipelineBuilder, batch, &devRect); 880 target->drawBatch(pipelineBuilder, batch, &devRect);
893 881
894 return true; 882 return true;
895 883
896 } 884 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698