skia2/tests/PathOpsTestCommon.h
caryclark a35ab3e6e0 fix fuzzers
Many old pathops-related fuzz failures have built up while
the codebase was under a state a flux. Now that the code
is stable, address these failures.

Most of the CL plumbs the debug global state to downstream
routines so that, if the data is not trusted (ala fuzzed)
the function can safely exit without asserting.

TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2426173002

Review-Url: https://chromiumcodereview.appspot.com/2426173002
2016-10-20 08:32:18 -07:00

43 lines
1.1 KiB
C

/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef PathOpsTestCommon_DEFINED
#define PathOpsTestCommon_DEFINED
#include "SkPathOpsQuad.h"
#include "SkTArray.h"
struct SkPathOpsBounds;
struct QuadPts {
static const int kPointCount = 3;
SkDPoint fPts[kPointCount];
};
struct ConicPts {
QuadPts fPts;
SkScalar fWeight;
};
struct CubicPts {
static const int kPointCount = 4;
SkDPoint fPts[kPointCount];
};
void CubicPathToQuads(const SkPath& cubicPath, SkPath* quadPath);
void CubicPathToSimple(const SkPath& cubicPath, SkPath* simplePath);
void CubicToQuads(const SkDCubic& cubic, double precision, SkTArray<SkDQuad, true>& quads);
bool ValidBounds(const SkPathOpsBounds& );
bool ValidConic(const SkDConic& cubic);
bool ValidCubic(const SkDCubic& cubic);
bool ValidLine(const SkDLine& line);
bool ValidPoint(const SkDPoint& pt);
bool ValidPoints(const SkPoint* pts, int count);
bool ValidQuad(const SkDQuad& quad);
bool ValidVector(const SkDVector& v);
#endif