Move from SkChunkAlloc to SkArenaAlloc for PathOps
Attempt two. Remove ~SkOpContour because it is handled by the SkArenaAlloc.
Change-Id: Id3049db97aebcc1009d403a031f2fac219f58f2f
Reviewed-on: https://skia-review.googlesource.com/9381
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/pathops/SkPathOpsTSect.h b/src/pathops/SkPathOpsTSect.h
index 4f2480d..ef0799d 100644
--- a/src/pathops/SkPathOpsTSect.h
+++ b/src/pathops/SkPathOpsTSect.h
@@ -7,7 +7,7 @@
#ifndef SkPathOpsTSect_DEFINED
#define SkPathOpsTSect_DEFINED
-#include "SkChunkAlloc.h"
+#include "SkArenaAlloc.h"
#include "SkPathOpsBounds.h"
#include "SkPathOpsRect.h"
#include "SkIntersections.h"
@@ -85,7 +85,7 @@
template<typename TCurve, typename OppCurve>
class SkTSpan {
public:
- void addBounded(SkTSpan<OppCurve, TCurve>* , SkChunkAlloc* );
+ void addBounded(SkTSpan<OppCurve, TCurve>* , SkArenaAlloc* );
double closestBoundedT(const SkDPoint& pt) const;
bool contains(double t) const;
@@ -174,11 +174,11 @@
initBounds(curve);
}
- bool split(SkTSpan* work, SkChunkAlloc* heap) {
+ bool split(SkTSpan* work, SkArenaAlloc* heap) {
return splitAt(work, (work->fStartT + work->fEndT) * 0.5, heap);
}
- bool splitAt(SkTSpan* work, double t, SkChunkAlloc* heap);
+ bool splitAt(SkTSpan* work, double t, SkArenaAlloc* heap);
double startT() const {
return fStartT;
@@ -317,7 +317,7 @@
void removeSpans(SkTSpan<TCurve, OppCurve>* span, SkTSect<OppCurve, TCurve>* opp);
void removedEndCheck(SkTSpan<TCurve, OppCurve>* span);
- void resetRemovedEnds() {
+ void resetRemovedEnds() {
fRemovedStartT = fRemovedEndT = false;
}
@@ -331,7 +331,7 @@
void validateBounded() const;
const TCurve& fCurve;
- SkChunkAlloc fHeap;
+ SkArenaAlloc fHeap;
SkTSpan<TCurve, OppCurve>* fHead;
SkTSpan<TCurve, OppCurve>* fCoincident;
SkTSpan<TCurve, OppCurve>* fDeleted;
@@ -389,9 +389,8 @@
}
template<typename TCurve, typename OppCurve>
-void SkTSpan<TCurve, OppCurve>::addBounded(SkTSpan<OppCurve, TCurve>* span, SkChunkAlloc* heap) {
- SkTSpanBounded<OppCurve, TCurve>* bounded = new (heap->allocThrow(
- sizeof(SkTSpanBounded<OppCurve, TCurve>)))(SkTSpanBounded<OppCurve, TCurve>);
+void SkTSpan<TCurve, OppCurve>::addBounded(SkTSpan<OppCurve, TCurve>* span, SkArenaAlloc* heap) {
+ SkTSpanBounded<OppCurve, TCurve>* bounded = heap->make<SkTSpanBounded<OppCurve, TCurve>>();
bounded->fBounded = span;
bounded->fNext = fBounded;
fBounded = bounded;
@@ -756,7 +755,7 @@
}
template<typename TCurve, typename OppCurve>
-bool SkTSpan<TCurve, OppCurve>::splitAt(SkTSpan* work, double t, SkChunkAlloc* heap) {
+bool SkTSpan<TCurve, OppCurve>::splitAt(SkTSpan* work, double t, SkArenaAlloc* heap) {
fStartT = t;
fEndT = work->fEndT;
if (fStartT == fEndT) {
@@ -858,7 +857,7 @@
template<typename TCurve, typename OppCurve>
-SkTSect<TCurve, OppCurve>::SkTSect(const TCurve& c
+SkTSect<TCurve, OppCurve>::SkTSect(const TCurve& c
SkDEBUGPARAMS(SkOpGlobalState* debugGlobalState)
PATH_OPS_DEBUG_T_SECT_PARAMS(int id))
: fCurve(c)
@@ -884,8 +883,7 @@
result = fDeleted;
fDeleted = result->fNext;
} else {
- result = new (fHeap.allocThrow(sizeof(SkTSpan<TCurve, OppCurve>)))(
- SkTSpan<TCurve, OppCurve>);
+ result = fHeap.make<SkTSpan<TCurve, OppCurve>>();
#if DEBUG_T_SECT
++fDebugAllocatedCount;
#endif