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

Unified Diff: src/pathops/SkPathOpsCubic.cpp

Issue 1037953004: add conics to path ops (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: turn off pathops specific debuggging Created 5 years, 8 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/SkPathOpsCubic.h ('k') | src/pathops/SkPathOpsCurve.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsCubic.cpp
diff --git a/src/pathops/SkPathOpsCubic.cpp b/src/pathops/SkPathOpsCubic.cpp
index d4a5898a1d16a60e521c14baf66b702cd02faa0f..a44d29bb0f32ead583b8a453e7d930fd9817510b 100644
--- a/src/pathops/SkPathOpsCubic.cpp
+++ b/src/pathops/SkPathOpsCubic.cpp
@@ -6,6 +6,7 @@
*/
#include "SkGeometry.h"
#include "SkLineParameters.h"
+#include "SkPathOpsConic.h"
#include "SkPathOpsCubic.h"
#include "SkPathOpsLine.h"
#include "SkPathOpsQuad.h"
@@ -105,7 +106,7 @@ bool SkDCubic::endsAreExtremaInXOrY() const {
/* if returning true, check contains true if cubic's hull collapsed, making the cubic linear
if returning false, check contains true if the the cubic pair have only the end point in common
*/
-bool SkDCubic::hullIntersects(const SkDCubic& c2, bool* isLinear) const {
+bool SkDCubic::hullIntersects(const SkDPoint* pts, int ptCount, bool* isLinear) const {
bool linear = true;
char hullOrder[4];
int hullCount = convexHull(hullOrder);
@@ -137,8 +138,8 @@ bool SkDCubic::hullIntersects(const SkDCubic& c2, bool* isLinear) const {
}
linear = false;
bool foundOutlier = false;
- for (int n = 0; n < kPointCount; ++n) {
- double test = (c2[n].fY - origY) * adj - (c2[n].fX - origX) * opp;
+ for (int n = 0; n < ptCount; ++n) {
+ double test = (pts[n].fY - origY) * adj - (pts[n].fX - origX) * opp;
if (test * sign > 0 && !precisely_zero(test)) {
foundOutlier = true;
break;
@@ -154,6 +155,19 @@ bool SkDCubic::hullIntersects(const SkDCubic& c2, bool* isLinear) const {
return true;
}
+bool SkDCubic::hullIntersects(const SkDCubic& c2, bool* isLinear) const {
+ return hullIntersects(c2.fPts, c2.kPointCount, isLinear);
+}
+
+bool SkDCubic::hullIntersects(const SkDQuad& quad, bool* isLinear) const {
+ return hullIntersects(quad.fPts, quad.kPointCount, isLinear);
+}
+
+bool SkDCubic::hullIntersects(const SkDConic& conic, bool* isLinear) const {
+
+ return hullIntersects(conic.fPts, isLinear);
+}
+
bool SkDCubic::isLinear(int startIndex, int endIndex) const {
SkLineParameters lineParameters;
lineParameters.cubicEndPoints(*this, startIndex, endIndex);
@@ -191,7 +205,7 @@ bool SkDCubic::ComplexBreak(const SkPoint pointsPtr[4], SkScalar* t) {
*t = (smaller + larger) / 2;
return *t > 0 && *t < 1;
}
- } else if (cubicType == kSerpentine_SkCubicType) {
+ } else if (kSerpentine_SkCubicType == cubicType || kCusp_SkCubicType == cubicType) {
SkDCubic cubic;
cubic.set(pointsPtr);
double inflectionTs[2];
« no previous file with comments | « src/pathops/SkPathOpsCubic.h ('k') | src/pathops/SkPathOpsCurve.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698