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

Unified Diff: ui/gfx/rect_f.cc

Issue 11270042: Add non-member non-mutating methods for common gfx::Rect operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 2 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 | « ui/gfx/rect_f.h ('k') | ui/gfx/rect_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/rect_f.cc
diff --git a/ui/gfx/rect_f.cc b/ui/gfx/rect_f.cc
index 85039244789099ed8f6922e520a31469ea7d6f24..6035391cff9f129997eb3933a08892f21a766b02 100644
--- a/ui/gfx/rect_f.cc
+++ b/ui/gfx/rect_f.cc
@@ -42,4 +42,28 @@ std::string RectF::ToString() const {
size().ToString().c_str());
}
+RectF IntersectRects(const RectF& a, const RectF& b) {
+ RectF result = a;
+ result.Intersect(b);
+ return result;
+}
+
+RectF UnionRects(const RectF& a, const RectF& b) {
+ RectF result = a;
+ result.Union(b);
+ return result;
+}
+
+RectF SubtractRects(const RectF& a, const RectF& b) {
+ RectF result = a;
+ result.Subtract(b);
+ return result;
+}
+
+RectF ScaleRect(const RectF& r, float x_scale, float y_scale) {
+ RectF result = r;
+ result.Scale(x_scale, y_scale);
+ return result;
+}
+
} // namespace gfx
« no previous file with comments | « ui/gfx/rect_f.h ('k') | ui/gfx/rect_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698