OLD | NEW |
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 "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } else { | 163 } else { |
164 dst[0] = dstTemp[0]; | 164 dst[0] = dstTemp[0]; |
165 } | 165 } |
166 return conicCnt; | 166 return conicCnt; |
167 } | 167 } |
168 | 168 |
169 // returns 0 if quad/conic is degen or close to it | 169 // returns 0 if quad/conic is degen or close to it |
170 // in this case approx the path with lines | 170 // in this case approx the path with lines |
171 // otherwise returns 1 | 171 // otherwise returns 1 |
172 static int is_degen_quad_or_conic(const SkPoint p[3], SkScalar* dsqd) { | 172 static int is_degen_quad_or_conic(const SkPoint p[3], SkScalar* dsqd) { |
173 static const SkScalar gDegenerateToLineTol = GrPathUtils::kDefaultTolerance; | 173 static const SkScalar gDegenerateToLineTol = SK_ScalarRoot2Over2; |
174 static const SkScalar gDegenerateToLineTolSqd = | 174 static const SkScalar gDegenerateToLineTolSqd = |
175 SkScalarMul(gDegenerateToLineTol, gDegenerateToLineTol); | 175 SkScalarMul(gDegenerateToLineTol, gDegenerateToLineTol); |
176 | 176 |
177 if (p[0].distanceToSqd(p[1]) < gDegenerateToLineTolSqd || | 177 if (p[0].distanceToSqd(p[1]) < gDegenerateToLineTolSqd || |
178 p[1].distanceToSqd(p[2]) < gDegenerateToLineTolSqd) { | 178 p[1].distanceToSqd(p[2]) < gDegenerateToLineTolSqd) { |
179 return 1; | 179 return 1; |
180 } | 180 } |
181 | 181 |
182 *dsqd = p[1].distanceToLineBetweenSqd(p[0], p[2]); | 182 *dsqd = p[1].distanceToLineBetweenSqd(p[0], p[2]); |
183 if (*dsqd < gDegenerateToLineTolSqd) { | 183 if (*dsqd < gDegenerateToLineTolSqd) { |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 GrColor color = GrRandomColor(random); | 978 GrColor color = GrRandomColor(random); |
979 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 979 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
980 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 980 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
981 SkPath path = GrTest::TestPath(random); | 981 SkPath path = GrTest::TestPath(random); |
982 SkIRect devClipBounds; | 982 SkIRect devClipBounds; |
983 devClipBounds.setEmpty(); | 983 devClipBounds.setEmpty(); |
984 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; | 984 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; |
985 } | 985 } |
986 | 986 |
987 #endif | 987 #endif |
OLD | NEW |