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

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

Issue 1111333002: compute initial winding from projected rays (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add missing test reference Created 5 years, 7 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/SkDQuadLineIntersection.cpp ('k') | src/pathops/SkIntersections.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 #ifndef SkIntersections_DEFINE 7 #ifndef SkIntersections_DEFINE
8 #define SkIntersections_DEFINE 8 #define SkIntersections_DEFINE
9 9
10 #include "SkPathOpsConic.h" 10 #include "SkPathOpsConic.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 return true; 217 return true;
218 } 218 }
219 219
220 void upDepth() { 220 void upDepth() {
221 SkASSERT(++fDepth < 16); 221 SkASSERT(++fDepth < 16);
222 } 222 }
223 223
224 void alignQuadPts(const SkPoint a[3], const SkPoint b[3]); 224 void alignQuadPts(const SkPoint a[3], const SkPoint b[3]);
225 int cleanUpCoincidence(); 225 int cleanUpCoincidence();
226 int closestTo(double rangeStart, double rangeEnd, const SkDPoint& testPt, do uble* dist) const; 226 int closestTo(double rangeStart, double rangeEnd, const SkDPoint& testPt, do uble* dist) const;
227 int coincidentUsed() const;
228 void cubicInsert(double one, double two, const SkDPoint& pt, const SkDCubic& c1, 227 void cubicInsert(double one, double two, const SkDPoint& pt, const SkDCubic& c1,
229 const SkDCubic& c2); 228 const SkDCubic& c2);
230 void flip(); 229 void flip();
231 int horizontal(const SkDLine&, double left, double right, double y, bool fli pped); 230 int horizontal(const SkDLine&, double left, double right, double y, bool fli pped);
232 int horizontal(const SkDQuad&, double left, double right, double y, bool fli pped); 231 int horizontal(const SkDQuad&, double left, double right, double y, bool fli pped);
233 int horizontal(const SkDQuad&, double left, double right, double y, double t Range[2]); 232 int horizontal(const SkDQuad&, double left, double right, double y, double t Range[2]);
234 int horizontal(const SkDCubic&, double y, double tRange[3]); 233 int horizontal(const SkDCubic&, double y, double tRange[3]);
235 int horizontal(const SkDConic&, double left, double right, double y, bool fl ipped); 234 int horizontal(const SkDConic&, double left, double right, double y, bool fl ipped);
236 int horizontal(const SkDCubic&, double left, double right, double y, bool fl ipped); 235 int horizontal(const SkDCubic&, double left, double right, double y, bool fl ipped);
237 int horizontal(const SkDCubic&, double left, double right, double y, double tRange[3]); 236 int horizontal(const SkDCubic&, double left, double right, double y, double tRange[3]);
237 static double HorizontalIntercept(const SkDLine& line, double y);
238 static int HorizontalIntercept(const SkDQuad& quad, SkScalar y, double* root s);
239 static int HorizontalIntercept(const SkDConic& conic, SkScalar y, double* ro ots);
238 // FIXME : does not respect swap 240 // FIXME : does not respect swap
239 int insert(double one, double two, const SkDPoint& pt); 241 int insert(double one, double two, const SkDPoint& pt);
240 void insertNear(double one, double two, const SkDPoint& pt1, const SkDPoint& pt2); 242 void insertNear(double one, double two, const SkDPoint& pt1, const SkDPoint& pt2);
241 // start if index == 0 : end if index == 1 243 // start if index == 0 : end if index == 1
242 int insertCoincident(double one, double two, const SkDPoint& pt); 244 int insertCoincident(double one, double two, const SkDPoint& pt);
243 int intersect(const SkDLine&, const SkDLine&); 245 int intersect(const SkDLine&, const SkDLine&);
244 int intersect(const SkDQuad&, const SkDLine&); 246 int intersect(const SkDQuad&, const SkDLine&);
245 int intersect(const SkDQuad&, const SkDQuad&); 247 int intersect(const SkDQuad&, const SkDQuad&);
246 int intersect(const SkDConic&, const SkDLine&); 248 int intersect(const SkDConic&, const SkDLine&);
247 int intersect(const SkDConic&, const SkDQuad&); 249 int intersect(const SkDConic&, const SkDQuad&);
248 int intersect(const SkDConic&, const SkDConic&); 250 int intersect(const SkDConic&, const SkDConic&);
249 int intersect(const SkDCubic&, const SkDLine&); 251 int intersect(const SkDCubic&, const SkDLine&);
250 int intersect(const SkDCubic&, const SkDQuad&); 252 int intersect(const SkDCubic&, const SkDQuad&);
251 int intersect(const SkDCubic&, const SkDConic&); 253 int intersect(const SkDCubic&, const SkDConic&);
252 int intersect(const SkDCubic&, const SkDCubic&); 254 int intersect(const SkDCubic&, const SkDCubic&);
253 int intersectRay(const SkDLine&, const SkDLine&); 255 int intersectRay(const SkDLine&, const SkDLine&);
254 int intersectRay(const SkDQuad&, const SkDLine&); 256 int intersectRay(const SkDQuad&, const SkDLine&);
255 int intersectRay(const SkDConic&, const SkDLine&); 257 int intersectRay(const SkDConic&, const SkDLine&);
256 int intersectRay(const SkDCubic&, const SkDLine&); 258 int intersectRay(const SkDCubic&, const SkDLine&);
257 void merge(const SkIntersections& , int , const SkIntersections& , int ); 259 void merge(const SkIntersections& , int , const SkIntersections& , int );
258 int mostOutside(double rangeStart, double rangeEnd, const SkDPoint& origin) const; 260 int mostOutside(double rangeStart, double rangeEnd, const SkDPoint& origin) const;
259 void quickRemoveOne(int index, int replace);
260 void removeOne(int index); 261 void removeOne(int index);
261 void setCoincident(int index); 262 void setCoincident(int index);
262 int vertical(const SkDLine&, double top, double bottom, double x, bool flipp ed); 263 int vertical(const SkDLine&, double top, double bottom, double x, bool flipp ed);
263 int vertical(const SkDQuad&, double top, double bottom, double x, bool flipp ed); 264 int vertical(const SkDQuad&, double top, double bottom, double x, bool flipp ed);
264 int vertical(const SkDConic&, double top, double bottom, double x, bool flip ped); 265 int vertical(const SkDConic&, double top, double bottom, double x, bool flip ped);
265 int vertical(const SkDCubic&, double top, double bottom, double x, bool flip ped); 266 int vertical(const SkDCubic&, double top, double bottom, double x, bool flip ped);
266 int verticalConic(const SkPoint a[3], SkScalar weight, SkScalar top, SkScala r bottom, 267 static double VerticalIntercept(const SkDLine& line, double x);
267 SkScalar x, bool flipped); 268 static int VerticalIntercept(const SkDQuad& quad, SkScalar x, double* roots) ;
268 int verticalCubic(const SkPoint a[4], SkScalar weight, SkScalar top, SkScala r bottom, 269 static int VerticalIntercept(const SkDConic& conic, SkScalar x, double* root s);
269 SkScalar x, bool flipped);
270 int verticalLine(const SkPoint a[2], SkScalar weight, SkScalar top, SkScalar bottom,
271 SkScalar x, bool flipped);
272 int verticalQuad(const SkPoint a[3], SkScalar weight, SkScalar top, SkScalar bottom,
273 SkScalar x, bool flipped);
274 270
275 int depth() const { 271 int depth() const {
276 #ifdef SK_DEBUG 272 #ifdef SK_DEBUG
277 return fDepth; 273 return fDepth;
278 #else 274 #else
279 return 0; 275 return 0;
280 #endif 276 #endif
281 } 277 }
282 278
279 int debugCoincidentUsed() const;
283 void dump() const; // implemented for testing only 280 void dump() const; // implemented for testing only
284 281
285 private: 282 private:
286 bool cubicCheckCoincidence(const SkDCubic& c1, const SkDCubic& c2); 283 bool cubicCheckCoincidence(const SkDCubic& c1, const SkDCubic& c2);
287 bool cubicExactEnd(const SkDCubic& cubic1, bool start, const SkDCubic& cubic 2); 284 bool cubicExactEnd(const SkDCubic& cubic1, bool start, const SkDCubic& cubic 2);
288 void cubicNearEnd(const SkDCubic& cubic1, bool start, const SkDCubic& cubic2 , const SkDRect& ); 285 void cubicNearEnd(const SkDCubic& cubic1, bool start, const SkDCubic& cubic2 , const SkDRect& );
289 void cleanUpParallelLines(bool parallel); 286 void cleanUpParallelLines(bool parallel);
290 void computePoints(const SkDLine& line, int used); 287 void computePoints(const SkDLine& line, int used);
291 288
292 SkDPoint fPt[10]; // FIXME: since scans store points as SkPoint, this shoul d also 289 SkDPoint fPt[10]; // FIXME: since scans store points as SkPoint, this shoul d also
293 SkDPoint fPt2[2]; // used by nearly same to store alternate intersection po int 290 SkDPoint fPt2[2]; // used by nearly same to store alternate intersection po int
294 double fT[2][10]; 291 double fT[2][10];
295 uint16_t fIsCoincident[2]; // bit set for each curve's coincident T 292 uint16_t fIsCoincident[2]; // bit set for each curve's coincident T
296 bool fNearlySame[2]; // true if end points nearly match 293 bool fNearlySame[2]; // true if end points nearly match
297 unsigned char fUsed; 294 unsigned char fUsed;
298 unsigned char fMax; 295 unsigned char fMax;
299 bool fAllowNear; 296 bool fAllowNear;
300 bool fSwap; 297 bool fSwap;
301 #ifdef SK_DEBUG 298 #ifdef SK_DEBUG
302 int fDepth; 299 int fDepth;
303 #endif 300 #endif
304 }; 301 };
305 302
306 extern int (SkIntersections::* const CurveVertical[])(const SkPoint[], SkScalar weight,
307 SkScalar top, SkScalar bottom, SkScalar x, bool flipped);
308
309 #endif 303 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkDQuadLineIntersection.cpp ('k') | src/pathops/SkIntersections.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698