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

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

Issue 2426173002: fix fuzzers (Closed)
Patch Set: fix dm Created 4 years, 2 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/SkPathOpsDebug.cpp ('k') | src/pathops/SkPathOpsRect.h » ('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
(...skipping 22 matching lines...) Expand all
33 SkDVector v01 = fPts[0] - fPts[1]; 33 SkDVector v01 = fPts[0] - fPts[1];
34 SkDVector v02 = fPts[0] - fPts[2]; 34 SkDVector v02 = fPts[0] - fPts[2];
35 SkDVector v12 = fPts[1] - fPts[2]; 35 SkDVector v12 = fPts[1] - fPts[2];
36 return v02.dot(v01) > 0 && v02.dot(v12) > 0; 36 return v02.dot(v01) > 0 && v02.dot(v12) > 0;
37 } 37 }
38 38
39 void debugInit() { 39 void debugInit() {
40 sk_bzero(fPts, sizeof(fPts)); 40 sk_bzero(fPts, sizeof(fPts));
41 } 41 }
42 42
43 void debugSet(const SkDPoint* pts);
44
43 SkDQuad flip() const { 45 SkDQuad flip() const {
44 SkDQuad result = {{fPts[2], fPts[1], fPts[0]}}; 46 SkDQuad result = {{fPts[2], fPts[1], fPts[0]} SkDEBUGPARAMS(fDebugGloba lState) };
45 return result; 47 return result;
46 } 48 }
47 49
48 static bool IsConic() { return false; } 50 static bool IsConic() { return false; }
49 51
50 const SkDQuad& set(const SkPoint pts[kPointCount]) { 52 const SkDQuad& set(const SkPoint pts[kPointCount]
53 SkDEBUGPARAMS(SkOpGlobalState* state = nullptr)) {
51 fPts[0] = pts[0]; 54 fPts[0] = pts[0];
52 fPts[1] = pts[1]; 55 fPts[1] = pts[1];
53 fPts[2] = pts[2]; 56 fPts[2] = pts[2];
57 SkDEBUGCODE(fDebugGlobalState = state);
54 return *this; 58 return *this;
55 } 59 }
56 60
57 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < kPointCount ); return fPts[n]; } 61 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < kPointCount ); return fPts[n]; }
58 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < kPointCount); return fP ts[n]; } 62 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < kPointCount); return fP ts[n]; }
59 63
60 static int AddValidTs(double s[], int realRoots, double* t); 64 static int AddValidTs(double s[], int realRoots, double* t);
61 void align(int endIndex, SkDPoint* dstPt) const; 65 void align(int endIndex, SkDPoint* dstPt) const;
62 SkDQuadPair chopAt(double t) const; 66 SkDQuadPair chopAt(double t) const;
63 SkDVector dxdyAtT(double t) const; 67 SkDVector dxdyAtT(double t) const;
64 static int FindExtrema(const double src[], double tValue[1]); 68 static int FindExtrema(const double src[], double tValue[1]);
65 69
70 #ifdef SK_DEBUG
71 SkOpGlobalState* globalState() const { return fDebugGlobalState; }
72 #endif
73
66 /** 74 /**
67 * Return the number of valid roots (0 < root < 1) for this cubic intersect ing the 75 * Return the number of valid roots (0 < root < 1) for this cubic intersect ing the
68 * specified horizontal line. 76 * specified horizontal line.
69 */ 77 */
70 int horizontalIntersect(double yIntercept, double roots[2]) const; 78 int horizontalIntersect(double yIntercept, double roots[2]) const;
71 79
72 bool hullIntersects(const SkDQuad& , bool* isLinear) const; 80 bool hullIntersects(const SkDQuad& , bool* isLinear) const;
73 bool hullIntersects(const SkDConic& , bool* isLinear) const; 81 bool hullIntersects(const SkDConic& , bool* isLinear) const;
74 bool hullIntersects(const SkDCubic& , bool* isLinear) const; 82 bool hullIntersects(const SkDCubic& , bool* isLinear) const;
75 bool isLinear(int startIndex, int endIndex) const; 83 bool isLinear(int startIndex, int endIndex) const;
(...skipping 23 matching lines...) Expand all
99 * specified vertical line. 107 * specified vertical line.
100 */ 108 */
101 int verticalIntersect(double xIntercept, double roots[2]) const; 109 int verticalIntersect(double xIntercept, double roots[2]) const;
102 110
103 SkDCubic debugToCubic() const; 111 SkDCubic debugToCubic() const;
104 // utilities callable by the user from the debugger when the implementation code is linked in 112 // utilities callable by the user from the debugger when the implementation code is linked in
105 void dump() const; 113 void dump() const;
106 void dumpID(int id) const; 114 void dumpID(int id) const;
107 void dumpInner() const; 115 void dumpInner() const;
108 116
109 private: 117 SkDEBUGCODE(SkOpGlobalState* fDebugGlobalState);
110 // static double Tangent(const double* quadratic, double t); // uncalled
111 }; 118 };
112 119
113 #endif 120 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsDebug.cpp ('k') | src/pathops/SkPathOpsRect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698