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

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

Issue 1126793003: Adjust tolerance to fix GPU hairline curve issues (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« 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 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 "GrAAHairLinePathRenderer.h" 8 #include "GrAAHairLinePathRenderer.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } else { 164 } else {
165 dst[0] = dstTemp[0]; 165 dst[0] = dstTemp[0];
166 } 166 }
167 return conicCnt; 167 return conicCnt;
168 } 168 }
169 169
170 // returns 0 if quad/conic is degen or close to it 170 // returns 0 if quad/conic is degen or close to it
171 // in this case approx the path with lines 171 // in this case approx the path with lines
172 // otherwise returns 1 172 // otherwise returns 1
173 static int is_degen_quad_or_conic(const SkPoint p[3], SkScalar* dsqd) { 173 static int is_degen_quad_or_conic(const SkPoint p[3], SkScalar* dsqd) {
174 static const SkScalar gDegenerateToLineTol = SK_Scalar1; 174 static const SkScalar gDegenerateToLineTol = GrPathUtils::kDefaultTolerance;
175 static const SkScalar gDegenerateToLineTolSqd = 175 static const SkScalar gDegenerateToLineTolSqd =
176 SkScalarMul(gDegenerateToLineTol, gDegenerateToLineTol); 176 SkScalarMul(gDegenerateToLineTol, gDegenerateToLineTol);
177 177
178 if (p[0].distanceToSqd(p[1]) < gDegenerateToLineTolSqd || 178 if (p[0].distanceToSqd(p[1]) < gDegenerateToLineTolSqd ||
179 p[1].distanceToSqd(p[2]) < gDegenerateToLineTolSqd) { 179 p[1].distanceToSqd(p[2]) < gDegenerateToLineTolSqd) {
180 return 1; 180 return 1;
181 } 181 }
182 182
183 *dsqd = p[1].distanceToLineBetweenSqd(p[0], p[2]); 183 *dsqd = p[1].distanceToLineBetweenSqd(p[0], p[2]);
184 if (*dsqd < gDegenerateToLineTolSqd) { 184 if (*dsqd < gDegenerateToLineTolSqd) {
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 GrColor color = GrRandomColor(random); 1054 GrColor color = GrRandomColor(random);
1055 SkMatrix viewMatrix = GrTest::TestMatrix(random); 1055 SkMatrix viewMatrix = GrTest::TestMatrix(random);
1056 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); 1056 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle);
1057 SkPath path = GrTest::TestPath(random); 1057 SkPath path = GrTest::TestPath(random);
1058 SkIRect devClipBounds; 1058 SkIRect devClipBounds;
1059 devClipBounds.setEmpty(); 1059 devClipBounds.setEmpty();
1060 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ; 1060 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ;
1061 } 1061 }
1062 1062
1063 #endif 1063 #endif
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