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

Unified Diff: src/pathops/SkOpSegment.cpp

Issue 1405383004: fix path op conic bugs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix w cast Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pathops/SkOpSegment.h ('k') | src/pathops/SkOpSpan.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkOpSegment.cpp
diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp
index 76032aaf0c6c2faf5d7f7c10028f253d60be0533..3b81cf2eed1384fc64f71190a66d96b04bed8aae 100644
--- a/src/pathops/SkOpSegment.cpp
+++ b/src/pathops/SkOpSegment.cpp
@@ -240,8 +240,11 @@ void SkOpSegment::addAlignIntersection(SkOpPtT& endPtT, SkPoint& oldPt,
} while ((current = current->next()));
}
-void SkOpSegment::addCurveTo(const SkOpSpanBase* start, const SkOpSpanBase* end,
- SkPathWriter* path, bool active) const {
+bool SkOpSegment::addCurveTo(const SkOpSpanBase* start, const SkOpSpanBase* end,
+ SkPathWriter* path) const {
+ if (start->starter(end)->alreadyAdded()) {
+ return false;
+ }
SkOpCurve edge;
const SkPoint* ePtr;
SkScalar eWeight;
@@ -254,46 +257,45 @@ void SkOpSegment::addCurveTo(const SkOpSpanBase* start, const SkOpSpanBase* end,
ePtr = edge.fPts;
eWeight = edge.fWeight;
}
- if (active) {
- bool reverse = ePtr == fPts && start != &fHead;
- if (reverse) {
- path->deferredMoveLine(ePtr[SkPathOpsVerbToPoints(fVerb)]);
- switch (fVerb) {
- case SkPath::kLine_Verb:
- path->deferredLine(ePtr[0]);
- break;
- case SkPath::kQuad_Verb:
- path->quadTo(ePtr[1], ePtr[0]);
- break;
- case SkPath::kConic_Verb:
- path->conicTo(ePtr[1], ePtr[0], eWeight);
- break;
- case SkPath::kCubic_Verb:
- path->cubicTo(ePtr[2], ePtr[1], ePtr[0]);
- break;
- default:
- SkASSERT(0);
- }
- } else {
- path->deferredMoveLine(ePtr[0]);
- switch (fVerb) {
- case SkPath::kLine_Verb:
- path->deferredLine(ePtr[1]);
- break;
- case SkPath::kQuad_Verb:
- path->quadTo(ePtr[1], ePtr[2]);
- break;
- case SkPath::kConic_Verb:
- path->conicTo(ePtr[1], ePtr[2], eWeight);
- break;
- case SkPath::kCubic_Verb:
- path->cubicTo(ePtr[1], ePtr[2], ePtr[3]);
- break;
- default:
- SkASSERT(0);
- }
+ bool reverse = ePtr == fPts && start != &fHead;
+ if (reverse) {
+ path->deferredMoveLine(ePtr[SkPathOpsVerbToPoints(fVerb)]);
+ switch (fVerb) {
+ case SkPath::kLine_Verb:
+ path->deferredLine(ePtr[0]);
+ break;
+ case SkPath::kQuad_Verb:
+ path->quadTo(ePtr[1], ePtr[0]);
+ break;
+ case SkPath::kConic_Verb:
+ path->conicTo(ePtr[1], ePtr[0], eWeight);
+ break;
+ case SkPath::kCubic_Verb:
+ path->cubicTo(ePtr[2], ePtr[1], ePtr[0]);
+ break;
+ default:
+ SkASSERT(0);
+ }
+ } else {
+ path->deferredMoveLine(ePtr[0]);
+ switch (fVerb) {
+ case SkPath::kLine_Verb:
+ path->deferredLine(ePtr[1]);
+ break;
+ case SkPath::kQuad_Verb:
+ path->quadTo(ePtr[1], ePtr[2]);
+ break;
+ case SkPath::kConic_Verb:
+ path->conicTo(ePtr[1], ePtr[2], eWeight);
+ break;
+ case SkPath::kCubic_Verb:
+ path->cubicTo(ePtr[1], ePtr[2], ePtr[3]);
+ break;
+ default:
+ SkASSERT(0);
}
}
+ return true;
}
SkOpPtT* SkOpSegment::addMissing(double t, SkOpSegment* opp, SkChunkAlloc* allocator) {
« no previous file with comments | « src/pathops/SkOpSegment.h ('k') | src/pathops/SkOpSpan.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698