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

Side by Side Diff: ui/gfx/geometry/rect_f.h

Issue 1357423009: gfx: Make conversions from Size to SizeF be explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sizefconvert-gfx: . Created 5 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/geometry/dip_util.cc ('k') | ui/gfx/geometry/size.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 #ifndef UI_GFX_GEOMETRY_RECT_F_H_ 5 #ifndef UI_GFX_GEOMETRY_RECT_F_H_
6 #define UI_GFX_GEOMETRY_RECT_F_H_ 6 #define UI_GFX_GEOMETRY_RECT_F_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <string> 9 #include <string>
10 10
(...skipping 15 matching lines...) Expand all
26 public: 26 public:
27 RectF() {} 27 RectF() {}
28 RectF(float width, float height) : size_(width, height) {} 28 RectF(float width, float height) : size_(width, height) {}
29 RectF(float x, float y, float width, float height) 29 RectF(float x, float y, float width, float height)
30 : origin_(x, y), size_(width, height) {} 30 : origin_(x, y), size_(width, height) {}
31 explicit RectF(const SizeF& size) : size_(size) {} 31 explicit RectF(const SizeF& size) : size_(size) {}
32 RectF(const PointF& origin, const SizeF& size) 32 RectF(const PointF& origin, const SizeF& size)
33 : origin_(origin), size_(size) {} 33 : origin_(origin), size_(size) {}
34 34
35 explicit RectF(const Rect& r) 35 explicit RectF(const Rect& r)
36 // TODO(danakj): Change these to checked_cast?
37 : RectF(static_cast<float>(r.x()), 36 : RectF(static_cast<float>(r.x()),
38 static_cast<float>(r.y()), 37 static_cast<float>(r.y()),
39 static_cast<float>(r.width()), 38 static_cast<float>(r.width()),
40 static_cast<float>(r.height())) {} 39 static_cast<float>(r.height())) {}
41 40
42 #if defined(OS_MACOSX) 41 #if defined(OS_MACOSX)
43 explicit RectF(const CGRect& r); 42 explicit RectF(const CGRect& r);
44 // Construct an equivalent CoreGraphics object. 43 // Construct an equivalent CoreGraphics object.
45 CGRect ToCGRect() const; 44 CGRect ToCGRect() const;
46 #endif 45 #endif
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 GFX_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2); 234 GFX_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2);
236 235
237 // This is declared here for use in gtest-based unit tests but is defined in 236 // This is declared here for use in gtest-based unit tests but is defined in
238 // the gfx_test_support target. Depend on that to use this in your unit test. 237 // the gfx_test_support target. Depend on that to use this in your unit test.
239 // This should not be used in production code - call ToString() instead. 238 // This should not be used in production code - call ToString() instead.
240 void PrintTo(const RectF& rect, ::std::ostream* os); 239 void PrintTo(const RectF& rect, ::std::ostream* os);
241 240
242 } // namespace gfx 241 } // namespace gfx
243 242
244 #endif // UI_GFX_GEOMETRY_RECT_F_H_ 243 #endif // UI_GFX_GEOMETRY_RECT_F_H_
OLDNEW
« no previous file with comments | « ui/gfx/geometry/dip_util.cc ('k') | ui/gfx/geometry/size.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698