Title: [106408] trunk/Source/WebCore
- Revision
- 106408
- Author
- [email protected]
- Date
- 2012-01-31 15:36:06 -0800 (Tue, 31 Jan 2012)
Log Message
Add contains() test to Region
https://bugs.webkit.org/show_bug.cgi?id=72294
Patch by Dana Jansens <[email protected]> on 2012-01-31
Reviewed by Anders Carlsson.
* platform/graphics/Region.cpp:
(WebCore::Region::contains):
(WebCore):
* platform/graphics/Region.h:
(Region):
(Shape):
(WebCore::operator==):
(WebCore):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (106407 => 106408)
--- trunk/Source/WebCore/ChangeLog 2012-01-31 23:24:55 UTC (rev 106407)
+++ trunk/Source/WebCore/ChangeLog 2012-01-31 23:36:06 UTC (rev 106408)
@@ -1,3 +1,19 @@
+2012-01-31 Dana Jansens <[email protected]>
+
+ Add contains() test to Region
+ https://bugs.webkit.org/show_bug.cgi?id=72294
+
+ Reviewed by Anders Carlsson.
+
+ * platform/graphics/Region.cpp:
+ (WebCore::Region::contains):
+ (WebCore):
+ * platform/graphics/Region.h:
+ (Region):
+ (Shape):
+ (WebCore::operator==):
+ (WebCore):
+
2012-01-31 Sami Kyostila <[email protected]>
[chromium] Compositor debug borders are not scaled correctly
Modified: trunk/Source/WebCore/platform/graphics/Region.cpp (106407 => 106408)
--- trunk/Source/WebCore/platform/graphics/Region.cpp 2012-01-31 23:24:55 UTC (rev 106407)
+++ trunk/Source/WebCore/platform/graphics/Region.cpp 2012-01-31 23:36:06 UTC (rev 106408)
@@ -65,6 +65,11 @@
return rects;
}
+bool Region::contains(const Region& region) const
+{
+ return WebCore::intersect(region, *this) == region;
+}
+
Region::Shape::Shape()
{
}
Modified: trunk/Source/WebCore/platform/graphics/Region.h (106407 => 106408)
--- trunk/Source/WebCore/platform/graphics/Region.h 2012-01-31 23:24:55 UTC (rev 106407)
+++ trunk/Source/WebCore/platform/graphics/Region.h 2012-01-31 23:36:06 UTC (rev 106408)
@@ -47,6 +47,9 @@
void translate(const IntSize&);
+ // Returns true if the query region is a subset of this region.
+ bool contains(const Region&) const;
+
#ifndef NDEBUG
void dump() const;
#endif
@@ -104,13 +107,18 @@
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 +145,21 @@
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
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes