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

Unified Diff: Source/platform/geometry/Region.h

Issue 183663030: Reduce number of vector buffer reallocs in Regions::unite . (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Simplify vectore pre-allocating Shape() constructor. Created 6 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 | « no previous file | Source/platform/geometry/Region.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/geometry/Region.h
diff --git a/Source/platform/geometry/Region.h b/Source/platform/geometry/Region.h
index efe743903a3524846af7af16dc2166cd00b88089..65e6c26a2d976ed84865c842a1eac6824d6f9cf3 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;
« no previous file with comments | « no previous file | Source/platform/geometry/Region.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698