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

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

Issue 1557903002: Fixed an assertion error in GrAAConvexTessellator. While adding a new point, it would check that th… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « 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 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "GrAAConvexTessellator.h" 8 #include "GrAAConvexTessellator.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 return; 828 return;
829 } 829 }
830 830
831 SkASSERT(fPts.count() <= 1 || fPts.count() == fNorms.count()+1); 831 SkASSERT(fPts.count() <= 1 || fPts.count() == fNorms.count()+1);
832 if (this->numPts() >= 2 && 832 if (this->numPts() >= 2 &&
833 abs_dist_from_line(fPts.top(), fNorms.top(), p) < kClose) { 833 abs_dist_from_line(fPts.top(), fNorms.top(), p) < kClose) {
834 // The old last point is on the line from the second to last to the new point 834 // The old last point is on the line from the second to last to the new point
835 this->popLastPt(); 835 this->popLastPt();
836 fNorms.pop(); 836 fNorms.pop();
837 fIsCurve.pop(); 837 fIsCurve.pop();
838 // double-check that the new last point is not a duplicate of the new po int. In an ideal
839 // world this wouldn't be necessary (since it's only possible for non-co nvex paths), but
840 // floating point precision issues mean it can actually happen on paths that were determined
841 // to be convex.
842 if (duplicate_pt(p, this->lastPoint())) {
843 return;
844 }
838 } 845 }
839 SkScalar initialRingCoverage = fStrokeWidth < 0.0f ? 0.5f : 1.0f; 846 SkScalar initialRingCoverage = fStrokeWidth < 0.0f ? 0.5f : 1.0f;
840 this->addPt(p, 0.0f, initialRingCoverage, false, isCurve); 847 this->addPt(p, 0.0f, initialRingCoverage, false, isCurve);
841 if (this->numPts() > 1) { 848 if (this->numPts() > 1) {
842 *fNorms.push() = fPts.top() - fPts[fPts.count()-2]; 849 *fNorms.push() = fPts.top() - fPts[fPts.count()-2];
843 SkDEBUGCODE(SkScalar len =) SkPoint::Normalize(&fNorms.top()); 850 SkDEBUGCODE(SkScalar len =) SkPoint::Normalize(&fNorms.top());
844 SkASSERT(len > 0.0f); 851 SkASSERT(len > 0.0f);
845 SkASSERT(SkScalarNearlyEqual(1.0f, fNorms.top().length())); 852 SkASSERT(SkScalarNearlyEqual(1.0f, fNorms.top().length()));
846 } 853 }
847 } 854 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 SkString num; 1025 SkString num;
1019 num.printf("%d", i); 1026 num.printf("%d", i);
1020 canvas->drawText(num.c_str(), num.size(), 1027 canvas->drawText(num.c_str(), num.size(),
1021 this->point(i).fX, this->point(i).fY+(kPointRadius/2.0f ), 1028 this->point(i).fX, this->point(i).fY+(kPointRadius/2.0f ),
1022 paint); 1029 paint);
1023 } 1030 }
1024 } 1031 }
1025 1032
1026 #endif 1033 #endif
1027 1034
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