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

Unified Diff: ui/gfx/rect_f.h

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: 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
« ui/gfx/rect.h ('K') | « ui/gfx/rect.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.h
diff --git a/ui/gfx/rect_f.h b/ui/gfx/rect_f.h
index 4ee1098bf9c14bc3e3196567170f45e6bbd97ad1..c527a7b0a2235e316f9911deea455683d9ad0d85 100644
--- a/ui/gfx/rect_f.h
+++ b/ui/gfx/rect_f.h
@@ -49,6 +49,34 @@ inline bool operator!=(const RectF& lhs, const RectF& rhs) {
return !(lhs == rhs);
}
+inline RectF Intersection(const RectF& a, const RectF& b) {
+ RectF result = a;
+ result.Intersect(b);
+ return result;
+}
+
+inline RectF Union(const RectF& a, const RectF& b) {
+ RectF result = a;
+ result.Union(b);
+ return result;
+}
+
+inline RectF Subtraction(const RectF& a, const RectF& b) {
+ RectF result = a;
+ result.Subtract(b);
+ return result;
+}
+
+inline RectF Scale(const RectF& r, float x_scale, float y_scale) {
+ RectF result = r;
+ result.Scale(x_scale, y_scale);
+ return result;
+}
+
+inline RectF Scale(const RectF& r, float scale) {
+ return Scale(r, scale, scale);
+}
+
#if !defined(COMPILER_MSVC)
extern template class RectBase<RectF, PointF, SizeF, InsetsF, float>;
#endif
« ui/gfx/rect.h ('K') | « ui/gfx/rect.h ('k') | ui/gfx/rect_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698