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

Unified Diff: src/pathops/SkOpSegment.h

Issue 16951017: convert pathops to use SkSTArray where possible. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: pathops use SkTArray Created 7 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/SkOpEdgeBuilder.cpp ('k') | src/pathops/SkOpSegment.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkOpSegment.h
diff --git a/src/pathops/SkOpSegment.h b/src/pathops/SkOpSegment.h
index b26bad14a630535a7d03ba356a077b6ee5cb0292..94efcb53fe5531a783dde8f6e261f315cfb647b8 100644
--- a/src/pathops/SkOpSegment.h
+++ b/src/pathops/SkOpSegment.h
@@ -11,6 +11,7 @@
#include "SkOpSpan.h"
#include "SkPathOpsBounds.h"
#include "SkPathOpsCurve.h"
+#include "SkTArray.h"
#include "SkTDArray.h"
class SkPathWriter;
@@ -230,7 +231,7 @@ public:
return xyAtT(span).fY;
}
- bool activeAngle(int index, int* done, SkTDArray<SkOpAngle>* angles);
+ bool activeAngle(int index, int* done, SkTArray<SkOpAngle, true>* angles);
SkPoint activeLeftTop(bool onlySortable, int* firstT) const;
bool activeOp(int index, int endIndex, int xorMiMask, int xorSuMask, SkPathOp op);
bool activeOp(int xorMiMask, int xorSuMask, int index, int endIndex, SkPathOp op,
@@ -294,7 +295,8 @@ public:
kMustBeOrdered_SortAngleKind, // required for winding calc
kMayBeUnordered_SortAngleKind // ok for find top
};
- static bool SortAngles(const SkTDArray<SkOpAngle>& angles, SkTDArray<SkOpAngle*>* angleList,
+ static bool SortAngles(const SkTArray<SkOpAngle, true>& angles,
+ SkTArray<SkOpAngle*, true>* angleList,
SortAngleKind );
bool subDivide(int start, int end, SkPoint edge[4]) const;
bool subDivide(int start, int end, SkDCubic* result) const;
@@ -315,9 +317,9 @@ public:
void debugShowActiveSpans() const;
#endif
#if DEBUG_SORT || DEBUG_SWAP_TOP
- void debugShowSort(const char* fun, const SkTDArray<SkOpAngle*>& angles, int first,
+ void debugShowSort(const char* fun, const SkTArray<SkOpAngle*, true>& angles, int first,
const int contourWinding, const int oppContourWinding) const;
- void debugShowSort(const char* fun, const SkTDArray<SkOpAngle*>& angles, int first);
+ void debugShowSort(const char* fun, const SkTArray<SkOpAngle*, true>& angles, int first);
#endif
#if DEBUG_CONCIDENT
void debugShowTs() const;
@@ -327,25 +329,25 @@ public:
#endif
private:
- bool activeAngleOther(int index, int* done, SkTDArray<SkOpAngle>* angles);
- bool activeAngleInner(int index, int* done, SkTDArray<SkOpAngle>* angles);
- void addAngle(SkTDArray<SkOpAngle>* angles, int start, int end) const;
+ bool activeAngleOther(int index, int* done, SkTArray<SkOpAngle, true>* angles);
+ bool activeAngleInner(int index, int* done, SkTArray<SkOpAngle, true>* angles);
+ void addAngle(SkTArray<SkOpAngle, true>* angles, int start, int end) const;
void addCancelOutsides(double tStart, double oStart, SkOpSegment* other, double oEnd);
- void addCoinOutsides(const SkTDArray<double>& outsideTs, SkOpSegment* other, double oEnd);
- void addTwoAngles(int start, int end, SkTDArray<SkOpAngle>* angles) const;
+ void addCoinOutsides(const SkTArray<double, true>& outsideTs, SkOpSegment* other, double oEnd);
+ void addTwoAngles(int start, int end, SkTArray<SkOpAngle, true>* angles) const;
int advanceCoincidentOther(const SkOpSpan* test, double oEndT, int oIndex);
int advanceCoincidentThis(const SkOpSpan* oTest, bool opp, int index);
- void buildAngles(int index, SkTDArray<SkOpAngle>* angles, bool includeOpp) const;
- void buildAnglesInner(int index, SkTDArray<SkOpAngle>* angles) const;
+ void buildAngles(int index, SkTArray<SkOpAngle, true>* angles, bool includeOpp) const;
+ void buildAnglesInner(int index, SkTArray<SkOpAngle, true>* angles) const;
int bumpCoincidentThis(const SkOpSpan& oTest, bool opp, int index,
- SkTDArray<double>* outsideTs);
+ SkTArray<double, true>* outsideTs);
int bumpCoincidentOther(const SkOpSpan& test, double oEndT, int& oIndex,
- SkTDArray<double>* oOutsideTs);
+ SkTArray<double, true>* oOutsideTs);
bool bumpSpan(SkOpSpan* span, int windDelta, int oppDelta);
bool clockwise(int tStart, int tEnd) const;
void decrementSpan(SkOpSpan* span);
bool equalPoints(int greaterTIndex, int lesserTIndex);
- int findStartingEdge(const SkTDArray<SkOpAngle*>& sorted, int start, int end);
+ int findStartingEdge(const SkTArray<SkOpAngle*, true>& sorted, int start, int end);
void init(const SkPoint pts[], SkPath::Verb verb, bool operand, bool evenOdd);
void matchWindingValue(int tIndex, double t, bool borrowWind);
SkOpSpan* markAndChaseDone(int index, int endIndex, int winding);
@@ -365,7 +367,7 @@ private:
SkOpSegment* nextChase(int* index, const int step, int* min, SkOpSpan** last);
bool serpentine(int tStart, int tEnd) const;
void subDivideBounds(int start, int end, SkPathOpsBounds* bounds) const;
- static void TrackOutside(SkTDArray<double>* outsideTs, double end, double start);
+ static void TrackOutside(SkTArray<double, true>* outsideTs, double end, double start);
int updateOppWinding(int index, int endIndex) const;
int updateOppWinding(const SkOpAngle* angle) const;
int updateWinding(int index, int endIndex) const;
@@ -393,6 +395,7 @@ private:
const SkPoint* fPts;
SkPathOpsBounds fBounds;
+ // FIXME: can't convert to SkTArray because it uses insert
SkTDArray<SkOpSpan> fTs; // two or more (always includes t=0 t=1)
// OPTIMIZATION: could pack donespans, verb, operand, xor into 1 int-sized value
int fDoneSpans; // quick check that segment is finished
« no previous file with comments | « src/pathops/SkOpEdgeBuilder.cpp ('k') | src/pathops/SkOpSegment.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698