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

Unified Diff: src/core/SkPath.cpp

Issue 1568513002: fix valgrind (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add comment 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPath.cpp
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 37592ddc3c875fb28c263d144baa8d888988040f..ab8d7359d2271b5a15b531859f44379522a4b378 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -2764,16 +2764,12 @@ static bool is_mono_quad(SkScalar y0, SkScalar y1, SkScalar y2) {
static int winding_conic(const SkPoint pts[], SkScalar x, SkScalar y, SkScalar weight,
int* onCurveCount) {
SkConic conic(pts, weight);
- SkConic *c = &conic;
SkConic chopped[2];
- int n = 0;
-
- if (!is_mono_quad(pts[0].fY, pts[1].fY, pts[2].fY)) {
- n = conic.chopAtYExtrema(chopped);
- c = chopped;
- }
- int w = winding_mono_conic(*c, x, y, onCurveCount);
- if (n > 0) {
+ // If the data points are very large, the conic may not be monotonic but may also
+ // fail to chop. Then, the chopper does not split the original conic in two.
+ bool isMono = is_mono_quad(pts[0].fY, pts[1].fY, pts[2].fY) || !conic.chopAtYExtrema(chopped);
+ int w = winding_mono_conic(isMono ? conic : chopped[0], x, y, onCurveCount);
+ if (!isMono) {
w += winding_mono_conic(chopped[1], x, y, onCurveCount);
}
return w;
« 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