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

Unified Diff: src/pathops/SkIntersections.h

Issue 272153002: fix bugs found by computing flat clips in 800K skps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix maybe-uninitialized error in unbuntu Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pathops/SkIntersectionHelper.h ('k') | src/pathops/SkIntersections.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkIntersections.h
diff --git a/src/pathops/SkIntersections.h b/src/pathops/SkIntersections.h
index eced4dd15fe9d8a4e6ef558c299ea4d36ad6a434..0186b3797d5101a0c045da08c7f6759e75094dc7 100644
--- a/src/pathops/SkIntersections.h
+++ b/src/pathops/SkIntersections.h
@@ -21,8 +21,10 @@ public:
#endif
{
sk_bzero(fPt, sizeof(fPt));
+ sk_bzero(fPt2, sizeof(fPt2));
sk_bzero(fT, sizeof(fT));
sk_bzero(fIsCoincident, sizeof(fIsCoincident));
+ sk_bzero(fNearlySame, sizeof(fNearlySame));
reset();
fMax = 0; // require that the caller set the max
}
@@ -37,16 +39,6 @@ public:
};
TArray operator[](int n) const { return TArray(fT[n]); }
- void set(const SkIntersections& i) {
- memcpy(fPt, i.fPt, sizeof(fPt));
- memcpy(fT, i.fT, sizeof(fT));
- memcpy(fIsCoincident, i.fIsCoincident, sizeof(fIsCoincident));
- fUsed = i.fUsed;
- fMax = i.fMax;
- fSwap = i.fSwap;
- SkDEBUGCODE(fDepth = i.fDepth);
- }
-
void allowNear(bool nearAllowed) {
fAllowNear = nearAllowed;
}
@@ -140,10 +132,19 @@ public:
return intersect(aLine, bLine);
}
+ bool nearlySame(int index) const {
+ SkASSERT(index == 0 || index == 1);
+ return fNearlySame[index];
+ }
+
const SkDPoint& pt(int index) const {
return fPt[index];
}
+ const SkDPoint& pt2(int index) const {
+ return fPt2[index];
+ }
+
int quadHorizontal(const SkPoint a[3], SkScalar left, SkScalar right, SkScalar y,
bool flipped) {
SkDQuad quad;
@@ -177,12 +178,16 @@ public:
return intersect(aQuad, bQuad);
}
- // leaves flip, swap, max alone
+ // leaves swap, max alone
void reset() {
fAllowNear = true;
fUsed = 0;
}
+ void set(bool swap, int tIndex, double t) {
+ fT[(int) swap][tIndex] = t;
+ }
+
void setMax(int max) {
fMax = max;
}
@@ -212,6 +217,8 @@ public:
void append(const SkIntersections& );
void cleanUpCoincidence();
int coincidentUsed() const;
+ void cubicInsert(double one, double two, const SkDPoint& pt, const SkDCubic& c1,
+ const SkDCubic& c2);
int cubicRay(const SkPoint pts[4], const SkDLine& line);
void flip();
int horizontal(const SkDLine&, double y);
@@ -223,7 +230,7 @@ public:
int horizontal(const SkDCubic&, double left, double right, double y, double tRange[3]);
// FIXME : does not respect swap
int insert(double one, double two, const SkDPoint& pt);
- void insertNear(double one, double two, const SkDPoint& pt);
+ void insertNear(double one, double two, const SkDPoint& pt1, const SkDPoint& pt2);
// start if index == 0 : end if index == 1
void insertCoincident(double one, double two, const SkDPoint& pt);
int intersect(const SkDLine&, const SkDLine&);
@@ -267,8 +274,10 @@ private:
void computePoints(const SkDLine& line, int used);
SkDPoint fPt[9]; // FIXME: since scans store points as SkPoint, this should also
+ SkDPoint fPt2[9]; // used by nearly same to store alternate intersection point
double fT[2][9];
uint16_t fIsCoincident[2]; // bit set for each curve's coincident T
+ bool fNearlySame[2]; // true if end points nearly match
unsigned char fUsed;
unsigned char fMax;
bool fAllowNear;
« no previous file with comments | « src/pathops/SkIntersectionHelper.h ('k') | src/pathops/SkIntersections.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698