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

Unified Diff: cc/stubs/Region.h

Issue 11275113: Remove most remaining references to IntRect and FloatRect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compositor bindings Created 8 years, 1 month 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 | « cc/solid_color_layer_impl_unittest.cc ('k') | cc/stubs/float_size.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/stubs/Region.h
diff --git a/cc/stubs/Region.h b/cc/stubs/Region.h
index 6930641c9cafad2e2fad6b117e4f449fb189e727..130e3e6dfe279307a6d2c4765359e3d99eeb8870 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_
« no previous file with comments | « cc/solid_color_layer_impl_unittest.cc ('k') | cc/stubs/float_size.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698