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

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

Issue 15338003: path ops -- rewrite angle sort (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« 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 SkDQuadPair { 13 struct SkDQuadPair {
14 const SkDQuad& first() const { return (const SkDQuad&) pts[0]; } 14 const SkDQuad& first() const { return (const SkDQuad&) pts[0]; }
15 const SkDQuad& second() const { return (const SkDQuad&) pts[2]; } 15 const SkDQuad& second() const { return (const SkDQuad&) pts[2]; }
16 SkDPoint pts[5]; 16 SkDPoint pts[5];
17 }; 17 };
18 18
19 struct SkDQuad { 19 struct SkDQuad {
20 SkDPoint fPts[3]; 20 SkDPoint fPts[3];
21 21
22 SkDQuad flip() const {
23 SkDQuad result = {{fPts[2], fPts[1], fPts[0]}};
24 return result;
25 }
26
22 void set(const SkPoint pts[3]) { 27 void set(const SkPoint pts[3]) {
23 fPts[0] = pts[0]; 28 fPts[0] = pts[0];
24 fPts[1] = pts[1]; 29 fPts[1] = pts[1];
25 fPts[2] = pts[2]; 30 fPts[2] = pts[2];
26 } 31 }
27 32
28 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < 3); return fPts[n]; } 33 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < 3); return fPts[n]; }
29 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < 3); return fPts[n]; } 34 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < 3); return fPts[n]; }
30 35
31 static int AddValidTs(double s[], int realRoots, double* t); 36 static int AddValidTs(double s[], int realRoots, double* t);
37 void align(int endIndex, SkDPoint* dstPt) const;
32 SkDQuadPair chopAt(double t) const; 38 SkDQuadPair chopAt(double t) const;
33 SkDVector dxdyAtT(double t) const; 39 SkDVector dxdyAtT(double t) const;
34 static int FindExtrema(double a, double b, double c, double tValue[1]); 40 static int FindExtrema(double a, double b, double c, double tValue[1]);
35 bool isLinear(int startIndex, int endIndex) const; 41 bool isLinear(int startIndex, int endIndex) const;
36 bool monotonicInY() const; 42 bool monotonicInY() const;
37 double nearestT(const SkDPoint&) const; 43 double nearestT(const SkDPoint&) const;
38 bool pointInHull(const SkDPoint&) const; 44 bool pointInHull(const SkDPoint&) const;
39 static int RootsReal(double A, double B, double C, double t[2]); 45 static int RootsReal(double A, double B, double C, double t[2]);
40 static int RootsValidT(const double A, const double B, const double C, doubl e s[2]); 46 static int RootsValidT(const double A, const double B, const double C, doubl e s[2]);
41 static void SetABC(const double* quad, double* a, double* b, double* c); 47 static void SetABC(const double* quad, double* a, double* b, double* c);
(...skipping 11 matching lines...) Expand all
53 return quad.subDivide(a, c, t1, t2); 59 return quad.subDivide(a, c, t1, t2);
54 } 60 }
55 SkDCubic toCubic() const; 61 SkDCubic toCubic() const;
56 SkDPoint top(double startT, double endT) const; 62 SkDPoint top(double startT, double endT) const;
57 SkDPoint xyAtT(double t) const; 63 SkDPoint xyAtT(double t) const;
58 private: 64 private:
59 // static double Tangent(const double* quadratic, double t); // uncalled 65 // static double Tangent(const double* quadratic, double t); // uncalled
60 }; 66 };
61 67
62 #endif 68 #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