Index: Source/platform/geometry/Region.h |
diff --git a/Source/platform/geometry/Region.h b/Source/platform/geometry/Region.h |
index efe743903a3524846af7af16dc2166cd00b88089..f7306a8119961ad90b2c1b606972a6cea592af8e 100644 |
--- a/Source/platform/geometry/Region.h |
+++ b/Source/platform/geometry/Region.h |
@@ -78,6 +78,7 @@ private: |
public: |
Shape(); |
Shape(const IntRect&); |
+ Shape(size_t segmentsCapacity, size_t spansCapacity); |
IntRect bounds() const; |
bool isEmpty() const { return m_spans.isEmpty(); } |
@@ -86,10 +87,12 @@ private: |
typedef const Span* SpanIterator; |
SpanIterator spansBegin() const; |
SpanIterator spansEnd() const; |
+ size_t spansSize() const { return m_spans.size(); } |
typedef const int* SegmentIterator; |
SegmentIterator segmentsBegin(SpanIterator) const; |
SegmentIterator segmentsEnd(SpanIterator) const; |
+ size_t segmentsSize() const { return m_segments.size(); } |
static Shape unionShapes(const Shape& shape1, const Shape& shape2); |
static Shape intersectShapes(const Shape& shape1, const Shape& shape2); |
@@ -103,6 +106,7 @@ private: |
template<typename CompareOperation> |
static bool compareShapes(const Shape& shape1, const Shape& shape2); |
+ void trimCapacities(); |
#ifndef NDEBUG |
void dump() const; |
@@ -123,8 +127,12 @@ private: |
bool canCoalesce(SegmentIterator begin, SegmentIterator end); |
- Vector<int, 32> m_segments; |
- Vector<Span, 16> m_spans; |
+ static const size_t segmentsDefaultCapacity = 32; |
+ static const size_t segmentsMask = segmentsDefaultCapacity - 1; |
+ Vector<int, segmentsDefaultCapacity> m_segments; |
+ static const size_t spansDefaultCapacity = 16; |
+ static const size_t spansMask = spansDefaultCapacity - 1; |
+ Vector<Span, spansDefaultCapacity> m_spans; |
friend bool operator==(const Shape&, const Shape&); |
}; |