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

Unified Diff: src/pathops/SkOpSegment.cpp

Issue 14865019: path ops work in progress (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pathops/SkOpSegment.h ('k') | src/pathops/SkPathOpsDebug.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkOpSegment.cpp
===================================================================
--- src/pathops/SkOpSegment.cpp (revision 9111)
+++ src/pathops/SkOpSegment.cpp (working copy)
@@ -210,8 +210,8 @@
#if DEBUG_ANGLE
SkTDArray<SkOpAngle>& angles = *anglesPtr;
if (angles.count() > 1 && !fTs[start].fTiny) {
- SkPoint angle0Pt = (*CurvePointAtT[angles[0].verb()])(angles[0].pts(),
- (*angles[0].spans())[angles[0].start()].fT);
+ const SkOpSegment* aSeg = angles[0].segment();
+ const SkPoint& angle0Pt = aSeg->xyAtT(angles[0].start());
SkPoint newPt = (*CurvePointAtT[fVerb])(fPts, fTs[start].fT);
bool match = AlmostEqualUlps(angle0Pt.fX, newPt.fX);
match &= AlmostEqualUlps(angle0Pt.fY, newPt.fY);
@@ -1177,12 +1177,12 @@
if (activeAngle) {
++activeCount;
if (!foundAngle || (foundDone && activeCount & 1)) {
- if (nextSegment->tiny(nextAngle)) {
+ if (nextSegment->isTiny(nextAngle)) {
*unsortable = true;
return NULL;
}
foundAngle = nextAngle;
- foundDone = nextSegment->done(nextAngle) && !nextSegment->tiny(nextAngle);
+ foundDone = nextSegment->done(nextAngle) && !nextSegment->isTiny(nextAngle);
}
}
if (nextSegment->done()) {
@@ -1294,7 +1294,7 @@
if (activeAngle) {
++activeCount;
if (!foundAngle || (foundDone && activeCount & 1)) {
- if (nextSegment->tiny(nextAngle)) {
+ if (nextSegment->isTiny(nextAngle)) {
*unsortable = true;
return NULL;
}
@@ -1416,7 +1416,7 @@
nextSegment = nextAngle->segment();
++activeCount;
if (!foundAngle || (foundDone && activeCount & 1)) {
- if (nextSegment->tiny(nextAngle)) {
+ if (nextSegment->isTiny(nextAngle)) {
*unsortable = true;
return NULL;
}
@@ -2379,13 +2379,25 @@
}
}
+void SkOpSegment::subDivide(int start, int end, SkDCubic* result) const {
+ (*result)[0].set(fTs[start].fPt);
+ (*result)[fVerb].set(fTs[end].fPt);
+ if (fVerb == SkPath::kQuad_Verb) {
+ (*result)[1] = SkDQuad::SubDivide(fPts, (*result)[0], (*result)[2], fTs[start].fT,
+ fTs[end].fT);
+ } else if (fVerb == SkPath::kCubic_Verb) {
+ SkDCubic::SubDivide(fPts, (*result)[0], (*result)[3], fTs[start].fT, fTs[end].fT,
+ &(*result)[1]);
+ }
+}
+
void SkOpSegment::subDivideBounds(int start, int end, SkPathOpsBounds* bounds) const {
SkPoint edge[4];
subDivide(start, end, edge);
(bounds->*SetCurveBounds[fVerb])(edge);
}
-bool SkOpSegment::tiny(const SkOpAngle* angle) const {
+bool SkOpSegment::isTiny(const SkOpAngle* angle) const {
int start = angle->start();
int end = angle->end();
const SkOpSpan& mSpan = fTs[SkMin32(start, end)];
@@ -2735,7 +2747,7 @@
}
SkDebugf("%s [%d] %s", __FUNCTION__, index,
angle.unsortable() ? "*** UNSORTABLE *** " : "");
- #if COMPACT_DEBUG_SORT
+ #if DEBUG_SORT_COMPACT
SkDebugf("id=%d %s start=%d (%1.9g,%,1.9g) end=%d (%1.9g,%,1.9g)",
segment.fID, kLVerbStr[segment.fVerb],
start, segment.xAtT(&sSpan), segment.yAtT(&sSpan), end,
« no previous file with comments | « src/pathops/SkOpSegment.h ('k') | src/pathops/SkPathOpsDebug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698