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

Side by Side Diff: src/pathops/SkPathOpsQuad.h

Issue 1096923003: working on initial winding for cubics (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/pathops/SkPathOpsPoint.h ('k') | src/pathops/SkPathOpsQuad.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
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 #ifndef SkPathOpsQuad_DEFINED 8 #ifndef SkPathOpsQuad_DEFINED
9 #define SkPathOpsQuad_DEFINED 9 #define SkPathOpsQuad_DEFINED
10 10
11 #include "SkPathOpsPoint.h" 11 #include "SkPathOpsPoint.h"
12 12
13 struct SkOpCurve;
14
13 struct SkDQuadPair { 15 struct SkDQuadPair {
14 const SkDQuad& first() const { return (const SkDQuad&) pts[0]; } 16 const SkDQuad& first() const { return (const SkDQuad&) pts[0]; }
15 const SkDQuad& second() const { return (const SkDQuad&) pts[2]; } 17 const SkDQuad& second() const { return (const SkDQuad&) pts[2]; }
16 SkDPoint pts[5]; 18 SkDPoint pts[5];
17 }; 19 };
18 20
19 struct SkDQuad { 21 struct SkDQuad {
20 static const int kPointCount = 3; 22 static const int kPointCount = 3;
21 static const int kPointLast = kPointCount - 1; 23 static const int kPointLast = kPointCount - 1;
22 static const int kMaxIntersections = 4; 24 static const int kMaxIntersections = 4;
(...skipping 28 matching lines...) Expand all
51 fPts[2] = pts[2]; 53 fPts[2] = pts[2];
52 return *this; 54 return *this;
53 } 55 }
54 56
55 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < kPointCount ); return fPts[n]; } 57 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < kPointCount ); return fPts[n]; }
56 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < kPointCount); return fP ts[n]; } 58 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < kPointCount); return fP ts[n]; }
57 59
58 static int AddValidTs(double s[], int realRoots, double* t); 60 static int AddValidTs(double s[], int realRoots, double* t);
59 void align(int endIndex, SkDPoint* dstPt) const; 61 void align(int endIndex, SkDPoint* dstPt) const;
60 SkDQuadPair chopAt(double t) const; 62 SkDQuadPair chopAt(double t) const;
63 static bool Clockwise(const SkOpCurve& edge, bool* swap);
61 SkDVector dxdyAtT(double t) const; 64 SkDVector dxdyAtT(double t) const;
62 static int FindExtrema(double a, double b, double c, double tValue[1]); 65 static int FindExtrema(double a, double b, double c, double tValue[1]);
63 bool hullIntersects(const SkDQuad& , bool* isLinear) const; 66 bool hullIntersects(const SkDQuad& , bool* isLinear) const;
64 bool hullIntersects(const SkDConic& , bool* isLinear) const; 67 bool hullIntersects(const SkDConic& , bool* isLinear) const;
65 bool hullIntersects(const SkDCubic& , bool* isLinear) const; 68 bool hullIntersects(const SkDCubic& , bool* isLinear) const;
66 bool isLinear(int startIndex, int endIndex) const; 69 bool isLinear(int startIndex, int endIndex) const;
67 bool monotonicInY() const; 70 bool monotonicInY() const;
68 double nearestT(const SkDPoint&) const; 71 double nearestT(const SkDPoint&) const;
69 void otherPts(int oddMan, const SkDPoint* endPt[2]) const; 72 void otherPts(int oddMan, const SkDPoint* endPt[2]) const;
70 SkDPoint ptAtT(double t) const; 73 SkDPoint ptAtT(double t) const;
71 static int RootsReal(double A, double B, double C, double t[2]); 74 static int RootsReal(double A, double B, double C, double t[2]);
72 static int RootsValidT(const double A, const double B, const double C, doubl e s[2]); 75 static int RootsValidT(const double A, const double B, const double C, doubl e s[2]);
73 static void SetABC(const double* quad, double* a, double* b, double* c); 76 static void SetABC(const double* quad, double* a, double* b, double* c);
74 SkDQuad subDivide(double t1, double t2) const; 77 SkDQuad subDivide(double t1, double t2) const;
75 static SkDQuad SubDivide(const SkPoint a[kPointCount], double t1, double t2) { 78 static SkDQuad SubDivide(const SkPoint a[kPointCount], double t1, double t2) {
76 SkDQuad quad; 79 SkDQuad quad;
77 quad.set(a); 80 quad.set(a);
78 return quad.subDivide(t1, t2); 81 return quad.subDivide(t1, t2);
79 } 82 }
80 SkDPoint subDivide(const SkDPoint& a, const SkDPoint& c, double t1, double t 2) const; 83 SkDPoint subDivide(const SkDPoint& a, const SkDPoint& c, double t1, double t 2) const;
81 static SkDPoint SubDivide(const SkPoint pts[kPointCount], const SkDPoint& a, const SkDPoint& c, 84 static SkDPoint SubDivide(const SkPoint pts[kPointCount], const SkDPoint& a, const SkDPoint& c,
82 double t1, double t2) { 85 double t1, double t2) {
83 SkDQuad quad; 86 SkDQuad quad;
84 quad.set(pts); 87 quad.set(pts);
85 return quad.subDivide(a, c, t1, t2); 88 return quad.subDivide(a, c, t1, t2);
86 } 89 }
87 SkDConic toConic() const; 90 SkDConic toConic() const;
88 SkDCubic toCubic() const; 91 SkDCubic toCubic() const;
89 SkDPoint top(double startT, double endT) const; 92 SkDPoint top(double startT, double endT, double* topT) const;
90 93
91 // utilities callable by the user from the debugger when the implementation code is linked in 94 // utilities callable by the user from the debugger when the implementation code is linked in
92 void dump() const; 95 void dump() const;
93 void dumpID(int id) const; 96 void dumpID(int id) const;
94 void dumpInner() const; 97 void dumpInner() const;
95 98
96 private: 99 private:
97 // static double Tangent(const double* quadratic, double t); // uncalled 100 // static double Tangent(const double* quadratic, double t); // uncalled
98 }; 101 };
99 102
100 #endif 103 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsPoint.h ('k') | src/pathops/SkPathOpsQuad.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698