aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkCoverageDelta.h
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2017-08-31 16:38:01 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-01 15:03:47 +0000
commit867017de0cd9d2104a291ddd6d6eef808edd82b6 (patch)
tree8ac0ad063914fd657db2211f36d06f559af8cb2f /src/core/SkCoverageDelta.h
parent9d4c9296648e11d91354cab5570cdf1b0b2f91bc (diff)
Use SkSTArenaAlloc to handle the stack memory of the delta list
Bug: skia: Change-Id: I5c98220498c71ced4565f492335cef2a372d0765 Reviewed-on: https://skia-review.googlesource.com/41743 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'src/core/SkCoverageDelta.h')
-rw-r--r--src/core/SkCoverageDelta.h19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/core/SkCoverageDelta.h b/src/core/SkCoverageDelta.h
index 9218157708..03cb4ff241 100644
--- a/src/core/SkCoverageDelta.h
+++ b/src/core/SkCoverageDelta.h
@@ -35,25 +35,20 @@ struct SkAntiRect {
SkAlpha fRightAlpha;
};
-using SkCoverageDeltaAllocator = SkSTArenaAlloc<256>;
-
// A list of SkCoverageDelta with y from top() to bottom().
// For each row y, there are count(y) number of deltas.
// You can ask whether they are sorted or not by sorted(y), and you can sort them by sort(y).
// Once sorted, getDelta(y, i) should return the i-th leftmost delta on row y.
class SkCoverageDeltaList {
public:
- // We can store INIT_ROW_SIZE deltas per row (i.e., per y-scanline) initially,
- // and we reserve RESERVED_HEIGHT rows on stack memory.
+ // We can store INIT_ROW_SIZE deltas per row (i.e., per y-scanline) initially.
#ifdef GOOGLE3
- static constexpr int INIT_ROW_SIZE = 8; // google3 has 16k stack limit
- static constexpr int RESERVED_HEIGHT = 120;
+ static constexpr int INIT_ROW_SIZE = 8; // google3 has 16k stack limit; so we make it small
#else
static constexpr int INIT_ROW_SIZE = 32;
- static constexpr int RESERVED_HEIGHT = 128;
#endif
- SkCoverageDeltaList(SkCoverageDeltaAllocator* alloc, int top, int bottom, bool forceRLE);
+ SkCoverageDeltaList(SkArenaAlloc* alloc, int top, int bottom, bool forceRLE);
int top() const { return fTop; }
int bottom() const { return fBottom; }
@@ -84,7 +79,7 @@ public:
}
private:
- SkCoverageDeltaAllocator* fAlloc;
+ SkArenaAlloc* fAlloc;
SkCoverageDelta** fRows;
bool* fSorted;
int* fCounts;
@@ -94,12 +89,6 @@ private:
SkAntiRect fAntiRect;
bool fForceRLE;
- SkCoverageDelta fReservedStorage[RESERVED_HEIGHT * INIT_ROW_SIZE];
- SkCoverageDelta* fReservedRows[RESERVED_HEIGHT];
- bool fReservedSorted[RESERVED_HEIGHT];
- int fReservedCounts[RESERVED_HEIGHT];
- int fReservedMaxCounts[RESERVED_HEIGHT];
-
void checkY(int y) const { SkASSERT(y >= fTop && y < fBottom); }
SK_ALWAYS_INLINE void push_back(int y, const SkCoverageDelta& delta) {