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

Side by Side Diff: ui/gfx/rect.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, 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/rect.h ('k') | ui/gfx/rect_f.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/rect.h" 5 #include "ui/gfx/rect.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #elif defined(TOOLKIT_GTK) 9 #elif defined(TOOLKIT_GTK)
10 #include <gdk/gdk.h> 10 #include <gdk/gdk.h>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return r; 81 return r;
82 } 82 }
83 #endif 83 #endif
84 84
85 std::string Rect::ToString() const { 85 std::string Rect::ToString() const {
86 return base::StringPrintf("%s %s", 86 return base::StringPrintf("%s %s",
87 origin().ToString().c_str(), 87 origin().ToString().c_str(),
88 size().ToString().c_str()); 88 size().ToString().c_str());
89 } 89 }
90 90
91 Rect IntersectRects(const Rect& a, const Rect& b) {
92 Rect result = a;
93 result.Intersect(b);
94 return result;
95 }
96
97 Rect UnionRects(const Rect& a, const Rect& b) {
98 Rect result = a;
99 result.Union(b);
100 return result;
101 }
102
103 Rect SubtractRects(const Rect& a, const Rect& b) {
104 Rect result = a;
105 result.Subtract(b);
106 return result;
107 }
108
91 } // namespace gfx 109 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/rect.h ('k') | ui/gfx/rect_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698