summaryrefslogtreecommitdiffstats
path: root/cc/stubs/Region.h
diff options
context:
space:
mode:
Diffstat (limited to 'cc/stubs/Region.h')
-rw-r--r--cc/stubs/Region.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/cc/stubs/Region.h b/cc/stubs/Region.h
index 6930641..130e3e6 100644
--- a/cc/stubs/Region.h
+++ b/cc/stubs/Region.h
@@ -11,6 +11,7 @@
#else
#include "third_party/WebKit/Source/WebCore/platform/graphics/Region.h"
#endif
+#include "ui/gfx/rect.h"
namespace cc {
@@ -32,8 +33,40 @@ public:
: WebCore::Region(region)
{
}
+
+ Region(const gfx::Rect& rect)
+ : WebCore::Region(WebCore::IntRect(rect.x(), rect.y(), rect.width(), rect.height()))
+ {
+ }
+
+ bool IsEmpty() const { return isEmpty(); }
+
+ bool Contains(const gfx::Point& point) const { return contains(cc::IntPoint(point)); }
+ bool Contains(const gfx::Rect& rect) const { return contains(cc::IntRect(rect)); }
+ void Subtract(const gfx::Rect& rect) { subtract(cc::IntRect(rect)); }
+ void Subtract(const Region& region) { subtract(region); }
+ void Union(const gfx::Rect& rect) { unite(cc::IntRect(rect)); }
+ void Union(const Region& region) { unite(region); }
+ void Intersect(const gfx::Rect& rect) { intersect(cc::IntRect(rect)); }
+ void Intersect(const Region& region) { intersect(region); }
+
+ gfx::Rect bounds() const { return cc::IntRect(WebCore::Region::bounds()); }
+
+private:
+ bool isEmpty() const { return WebCore::Region::isEmpty(); }
+ bool contains(const IntPoint& point) const { return WebCore::Region::contains(point); }
+ bool contains(const IntRect& rect) const { return WebCore::Region::contains(rect); }
+ void subtract(const IntRect& rect) { return WebCore::Region::subtract(rect); }
+ void subtract(const Region& region) { return WebCore::Region::subtract(region); }
+ void unite(const IntRect& rect) { return WebCore::Region::unite(rect); }
+ void unite(const Region& region) { return WebCore::Region::unite(region); }
+ void intersect(const IntRect& rect) { return WebCore::Region::intersect(rect); }
+ void intersect(const Region& region) { return WebCore::Region::intersect(region); }
};
+inline Region subtract(const Region& region, const gfx::Rect& rect) { return WebCore::intersect(region, cc::IntRect(rect)); }
+inline Region intersect(const Region& region, const gfx::Rect& rect) { return WebCore::intersect(region, cc::IntRect(rect)); }
+
}
#endif // CC_STUBS_REGION_H_