fix valgrind

(A recently added fuzzer test broke the valgrind bot, intentionally,
to isolate an uninitialized memory bug.)

If the conic has ordered points, but cannot be broken into parts,
treat it as if it were monotonic.

R=reed@google.com
BUG=skia:4757
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1568513002

Review URL: https://codereview.chromium.org/1568513002
This commit is contained in:
caryclark 2016-01-06 08:15:44 -08:00 committed by Commit bot
parent 19c6250cad
commit e114dd6316

View File

@ -2764,16 +2764,10 @@ 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) {
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;