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

Side by Side 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, 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_f.h ('k') | ui/gfx/rect_unittest.cc » ('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_f.h" 5 #include "ui/gfx/rect_f.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "ui/gfx/insets_f.h" 9 #include "ui/gfx/insets_f.h"
10 #include "ui/gfx/rect_base_impl.h" 10 #include "ui/gfx/rect_base_impl.h"
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 36
37 RectF::~RectF() {} 37 RectF::~RectF() {}
38 38
39 std::string RectF::ToString() const { 39 std::string RectF::ToString() const {
40 return base::StringPrintf("%s %s", 40 return base::StringPrintf("%s %s",
41 origin().ToString().c_str(), 41 origin().ToString().c_str(),
42 size().ToString().c_str()); 42 size().ToString().c_str());
43 } 43 }
44 44
45 RectF IntersectRects(const RectF& a, const RectF& b) {
46 RectF result = a;
47 result.Intersect(b);
48 return result;
49 }
50
51 RectF UnionRects(const RectF& a, const RectF& b) {
52 RectF result = a;
53 result.Union(b);
54 return result;
55 }
56
57 RectF SubtractRects(const RectF& a, const RectF& b) {
58 RectF result = a;
59 result.Subtract(b);
60 return result;
61 }
62
63 RectF ScaleRect(const RectF& r, float x_scale, float y_scale) {
64 RectF result = r;
65 result.Scale(x_scale, y_scale);
66 return result;
67 }
68
45 } // namespace gfx 69 } // namespace gfx
OLDNEW
« 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