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

Unified Diff: src/gpu/GrAAHairLinePathRenderer.cpp

Issue 934283002: gm to test hairlines which fill RenderTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nits 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/gmslides.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAAHairLinePathRenderer.cpp
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index fe89b887bd66761a48f2deef7af3cd8fb33f82e3..c1d1291469529d4d580e1e3be681c79c4b3221be 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -184,7 +184,7 @@ int chop_conic(const SkPoint src[3], SkConic dst[4], const SkScalar weight) {
// returns 0 if quad/conic is degen or close to it
// in this case approx the path with lines
// otherwise returns 1
-int is_degen_quad_or_conic(const SkPoint p[3]) {
+int is_degen_quad_or_conic(const SkPoint p[3], SkScalar* dsqd) {
static const SkScalar gDegenerateToLineTol = SK_Scalar1;
static const SkScalar gDegenerateToLineTolSqd =
SkScalarMul(gDegenerateToLineTol, gDegenerateToLineTol);
@@ -194,8 +194,8 @@ int is_degen_quad_or_conic(const SkPoint p[3]) {
return 1;
}
- SkScalar dsqd = p[1].distanceToLineBetweenSqd(p[0], p[2]);
- if (dsqd < gDegenerateToLineTolSqd) {
+ *dsqd = p[1].distanceToLineBetweenSqd(p[0], p[2]);
+ if (*dsqd < gDegenerateToLineTolSqd) {
return 1;
}
@@ -205,24 +205,16 @@ int is_degen_quad_or_conic(const SkPoint p[3]) {
return 0;
}
+int is_degen_quad_or_conic(const SkPoint p[3]) {
+ SkScalar dsqd;
+ return is_degen_quad_or_conic(p, &dsqd);
+}
+
// we subdivide the quads to avoid huge overfill
// if it returns -1 then should be drawn as lines
int num_quad_subdivs(const SkPoint p[3]) {
- static const SkScalar gDegenerateToLineTol = SK_Scalar1;
- static const SkScalar gDegenerateToLineTolSqd =
- SkScalarMul(gDegenerateToLineTol, gDegenerateToLineTol);
-
- if (p[0].distanceToSqd(p[1]) < gDegenerateToLineTolSqd ||
- p[1].distanceToSqd(p[2]) < gDegenerateToLineTolSqd) {
- return -1;
- }
-
- SkScalar dsqd = p[1].distanceToLineBetweenSqd(p[0], p[2]);
- if (dsqd < gDegenerateToLineTolSqd) {
- return -1;
- }
-
- if (p[2].distanceToLineBetweenSqd(p[1], p[0]) < gDegenerateToLineTolSqd) {
+ SkScalar dsqd;
+ if (is_degen_quad_or_conic(p, &dsqd)) {
return -1;
}
« no previous file with comments | « gyp/gmslides.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698