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

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

Issue 1322413002: remove unused fields from SkOpSegment (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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/SkOpSegment.cpp ('k') | src/pathops/SkPathOpsCubic.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 SkPathOpsCubic_DEFINED 8 #ifndef SkPathOpsCubic_DEFINED
9 #define SkPathOpsCubic_DEFINED 9 #define SkPathOpsCubic_DEFINED
10 10
11 #include "SkPath.h" 11 #include "SkPath.h"
12 #include "SkPathOpsPoint.h" 12 #include "SkPathOpsPoint.h"
13 13
14 struct SkDCubicPair { 14 struct SkDCubicPair {
15 const SkDCubic& first() const { return (const SkDCubic&) pts[0]; } 15 const SkDCubic& first() const { return (const SkDCubic&) pts[0]; }
16 const SkDCubic& second() const { return (const SkDCubic&) pts[3]; } 16 const SkDCubic& second() const { return (const SkDCubic&) pts[3]; }
17 SkDPoint pts[7]; 17 SkDPoint pts[7];
18 }; 18 };
19 19
20 struct SkDCubic { 20 struct SkDCubic {
21 static const int kPointCount = 4; 21 static const int kPointCount = 4;
22 static const int kPointLast = kPointCount - 1; 22 static const int kPointLast = kPointCount - 1;
23 static const int kMaxIntersections = 9; 23 static const int kMaxIntersections = 9;
24 24
25 enum SearchAxis { 25 enum SearchAxis {
26 kXAxis, 26 kXAxis,
27 kYAxis 27 kYAxis
28 }; 28 };
29 29
30 enum CubicType {
31 kUnsplit_SkDCubicType,
32 kSplitAtLoop_SkDCubicType,
33 kSplitAtInflection_SkDCubicType,
34 kSplitAtMaxCurvature_SkDCubicType,
35 };
36
37 bool collapsed() const { 30 bool collapsed() const {
38 return fPts[0].approximatelyEqual(fPts[1]) && fPts[0].approximatelyEqual (fPts[2]) 31 return fPts[0].approximatelyEqual(fPts[1]) && fPts[0].approximatelyEqual (fPts[2])
39 && fPts[0].approximatelyEqual(fPts[3]); 32 && fPts[0].approximatelyEqual(fPts[3]);
40 } 33 }
41 34
42 bool controlsInside() const { 35 bool controlsInside() const {
43 SkDVector v01 = fPts[0] - fPts[1]; 36 SkDVector v01 = fPts[0] - fPts[1];
44 SkDVector v02 = fPts[0] - fPts[2]; 37 SkDVector v02 = fPts[0] - fPts[2];
45 SkDVector v03 = fPts[0] - fPts[3]; 38 SkDVector v03 = fPts[0] - fPts[3];
46 SkDVector v13 = fPts[1] - fPts[3]; 39 SkDVector v13 = fPts[1] - fPts[3];
47 SkDVector v23 = fPts[2] - fPts[3]; 40 SkDVector v23 = fPts[2] - fPts[3];
48 return v03.dot(v01) > 0 && v03.dot(v02) > 0 && v03.dot(v13) > 0 && v03.d ot(v23) > 0; 41 return v03.dot(v01) > 0 && v03.dot(v02) > 0 && v03.dot(v13) > 0 && v03.d ot(v23) > 0;
49 } 42 }
50 43
51 static bool IsCubic() { return true; } 44 static bool IsCubic() { return true; }
52 45
53 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < kPointCount ); return fPts[n]; } 46 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < kPointCount ); return fPts[n]; }
54 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < kPointCount); return fP ts[n]; } 47 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < kPointCount); return fP ts[n]; }
55 48
56 void align(int endIndex, int ctrlIndex, SkDPoint* dstPt) const; 49 void align(int endIndex, int ctrlIndex, SkDPoint* dstPt) const;
57 double binarySearch(double min, double max, double axisIntercept, SearchAxis xAxis) const; 50 double binarySearch(double min, double max, double axisIntercept, SearchAxis xAxis) const;
58 double calcPrecision() const; 51 double calcPrecision() const;
59 SkDCubicPair chopAt(double t) const; 52 SkDCubicPair chopAt(double t) const;
60 static void Coefficients(const double* cubic, double* A, double* B, double* C, double* D); 53 static void Coefficients(const double* cubic, double* A, double* B, double* C, double* D);
61 static bool ComplexBreak(const SkPoint pts[4], SkScalar* t, CubicType* cubic Type); 54 static bool ComplexBreak(const SkPoint pts[4], SkScalar* t);
62 int convexHull(char order[kPointCount]) const; 55 int convexHull(char order[kPointCount]) const;
63 56
64 void debugInit() { 57 void debugInit() {
65 sk_bzero(fPts, sizeof(fPts)); 58 sk_bzero(fPts, sizeof(fPts));
66 } 59 }
67 60
68 void dump() const; // callable from the debugger when the implementation co de is linked in 61 void dump() const; // callable from the debugger when the implementation co de is linked in
69 void dumpID(int id) const; 62 void dumpID(int id) const;
70 void dumpInner() const; 63 void dumpInner() const;
71 SkDVector dxdyAtT(double t) const; 64 SkDVector dxdyAtT(double t) const;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 returned == 3 for (0, 1), (0, 2), (1, 3), (2, 3) 141 returned == 3 for (0, 1), (0, 2), (1, 3), (2, 3)
149 given that: 142 given that:
150 (0, 3) ^ 2 -> (2, 1) (1, 2) ^ 2 -> (3, 0) 143 (0, 3) ^ 2 -> (2, 1) (1, 2) ^ 2 -> (3, 0)
151 (0, 1) ^ 3 -> (3, 2) (0, 2) ^ 3 -> (3, 1) (1, 3) ^ 3 -> (2, 0) (2, 3) ^ 3 -> (1, 0) 144 (0, 1) ^ 3 -> (3, 2) (0, 2) ^ 3 -> (3, 1) (1, 3) ^ 3 -> (2, 0) (2, 3) ^ 3 -> (1, 0)
152 */ 145 */
153 inline int other_two(int one, int two) { 146 inline int other_two(int one, int two) {
154 return 1 >> (3 - (one ^ two)) ^ 3; 147 return 1 >> (3 - (one ^ two)) ^ 3;
155 } 148 }
156 149
157 #endif 150 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkOpSegment.cpp ('k') | src/pathops/SkPathOpsCubic.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698