1 /* 2 * Copyright 2012 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 #ifndef PathOpsTestCommon_DEFINED 8 #define PathOpsTestCommon_DEFINED 9 10 #include "include/core/SkScalar.h" 11 #include "include/private/base/SkTArray.h" 12 #include "src/pathops/SkPathOpsPoint.h" 13 14 class SkPath; 15 struct SkDConic; 16 struct SkDCubic; 17 struct SkDLine; 18 struct SkDQuad; 19 struct SkPathOpsBounds; 20 struct SkPoint; 21 22 struct QuadPts { 23 static const int kPointCount = 3; 24 SkDPoint fPts[kPointCount]; 25 }; 26 27 struct ConicPts { 28 QuadPts fPts; 29 SkScalar fWeight; 30 }; 31 32 struct CubicPts { 33 static const int kPointCount = 4; 34 SkDPoint fPts[kPointCount]; 35 }; 36 37 void CubicPathToQuads(const SkPath& cubicPath, SkPath* quadPath); 38 void CubicPathToSimple(const SkPath& cubicPath, SkPath* simplePath); 39 void CubicToQuads( 40 const SkDCubic& cubic, double precision, skia_private::TArray<SkDQuad, true>& quads); 41 bool ValidBounds(const SkPathOpsBounds& ); 42 bool ValidConic(const SkDConic& cubic); 43 bool ValidCubic(const SkDCubic& cubic); 44 bool ValidLine(const SkDLine& line); 45 bool ValidPoint(const SkDPoint& pt); 46 bool ValidPoints(const SkPoint* pts, int count); 47 bool ValidQuad(const SkDQuad& quad); 48 bool ValidVector(const SkDVector& v); 49 50 #endif 51