| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 "SkBuffer.h" | 8 #include "SkBuffer.h" |
| 9 #include "SkCubicClipper.h" | 9 #include "SkCubicClipper.h" |
| 10 #include "SkErrorInternals.h" | 10 #include "SkErrorInternals.h" |
| (...skipping 2747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2758 return y1 <= y2; | 2758 return y1 <= y2; |
| 2759 } else { | 2759 } else { |
| 2760 return y1 >= y2; | 2760 return y1 >= y2; |
| 2761 } | 2761 } |
| 2762 } | 2762 } |
| 2763 | 2763 |
| 2764 static int winding_conic(const SkPoint pts[], SkScalar x, SkScalar y, SkScalar w
eight, | 2764 static int winding_conic(const SkPoint pts[], SkScalar x, SkScalar y, SkScalar w
eight, |
| 2765 int* onCurveCount) { | 2765 int* onCurveCount) { |
| 2766 SkConic conic(pts, weight); | 2766 SkConic conic(pts, weight); |
| 2767 SkConic chopped[2]; | 2767 SkConic chopped[2]; |
| 2768 // If the data points are very large, the conic may not be monotonic but may
also |
| 2769 // fail to chop. Then, the chopper does not split the original conic in two. |
| 2768 bool isMono = is_mono_quad(pts[0].fY, pts[1].fY, pts[2].fY) || !conic.chopAt
YExtrema(chopped); | 2770 bool isMono = is_mono_quad(pts[0].fY, pts[1].fY, pts[2].fY) || !conic.chopAt
YExtrema(chopped); |
| 2769 int w = winding_mono_conic(isMono ? conic : chopped[0], x, y, onCurveCount); | 2771 int w = winding_mono_conic(isMono ? conic : chopped[0], x, y, onCurveCount); |
| 2770 if (!isMono) { | 2772 if (!isMono) { |
| 2771 w += winding_mono_conic(chopped[1], x, y, onCurveCount); | 2773 w += winding_mono_conic(chopped[1], x, y, onCurveCount); |
| 2772 } | 2774 } |
| 2773 return w; | 2775 return w; |
| 2774 } | 2776 } |
| 2775 | 2777 |
| 2776 static int winding_mono_quad(const SkPoint pts[], SkScalar x, SkScalar y, int* o
nCurveCount) { | 2778 static int winding_mono_quad(const SkPoint pts[], SkScalar x, SkScalar y, int* o
nCurveCount) { |
| 2777 SkScalar y0 = pts[0].fY; | 2779 SkScalar y0 = pts[0].fY; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3085 } | 3087 } |
| 3086 } while (!done); | 3088 } while (!done); |
| 3087 return SkToBool(tangents.count()) ^ isInverse; | 3089 return SkToBool(tangents.count()) ^ isInverse; |
| 3088 } | 3090 } |
| 3089 | 3091 |
| 3090 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo
int& p2, | 3092 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo
int& p2, |
| 3091 SkScalar w, SkPoint pts[], int pow2) { | 3093 SkScalar w, SkPoint pts[], int pow2) { |
| 3092 const SkConic conic(p0, p1, p2, w); | 3094 const SkConic conic(p0, p1, p2, w); |
| 3093 return conic.chopIntoQuadsPOW2(pts, pow2); | 3095 return conic.chopIntoQuadsPOW2(pts, pow2); |
| 3094 } | 3096 } |
| OLD | NEW |