summaryrefslogtreecommitdiff
path: root/Source/WebCore/platform/graphics/Region.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/Region.h')
-rw-r--r--Source/WebCore/platform/graphics/Region.h31
1 files changed, 28 insertions, 3 deletions
diff --git a/Source/WebCore/platform/graphics/Region.h b/Source/WebCore/platform/graphics/Region.h
index b5359bbe3..8bc839578 100644
--- a/Source/WebCore/platform/graphics/Region.h
+++ b/Source/WebCore/platform/graphics/Region.h
@@ -47,6 +47,11 @@ public:
void translate(const IntSize&);
+ // Returns true if the query region is a subset of this region.
+ bool contains(const Region&) const;
+
+ bool contains(const IntPoint&) const;
+
#ifndef NDEBUG
void dump() const;
#endif
@@ -104,13 +109,18 @@ private:
bool canCoalesce(SegmentIterator begin, SegmentIterator end);
- // FIXME: These vectors should have inline sizes. Figure out a good optimal value.
- Vector<int> m_segments;
- Vector<Span> m_spans;
+ Vector<int, 32> m_segments;
+ Vector<Span, 16> m_spans;
+
+ friend bool operator==(const Shape&, const Shape&);
};
IntRect m_bounds;
Shape m_shape;
+
+ friend bool operator==(const Region&, const Region&);
+ friend bool operator==(const Shape&, const Shape&);
+ friend bool operator==(const Span&, const Span&);
};
static inline Region intersect(const Region& a, const Region& b)
@@ -137,6 +147,21 @@ static inline Region translate(const Region& region, const IntSize& offset)
return result;
}
+inline bool operator==(const Region& a, const Region& b)
+{
+ return a.m_bounds == b.m_bounds && a.m_shape == b.m_shape;
+}
+
+inline bool operator==(const Region::Shape& a, const Region::Shape& b)
+{
+ return a.m_spans == b.m_spans && a.m_segments == b.m_segments;
+}
+
+inline bool operator==(const Region::Span& a, const Region::Span& b)
+{
+ return a.y == b.y && a.segmentIndex == b.segmentIndex;
+}
+
} // namespace WebCore
#endif // Region_h