OLD | NEW |
---|---|
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_INSETS_H_ | 5 #ifndef UI_GFX_GEOMETRY_INSETS_H_ |
6 #define UI_GFX_GEOMETRY_INSETS_H_ | 6 #define UI_GFX_GEOMETRY_INSETS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ui/gfx/geometry/insets_f.h" | 10 #include "ui/gfx/geometry/insets_f.h" |
11 #include "ui/gfx/gfx_export.h" | 11 #include "ui/gfx/gfx_export.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 | 14 |
15 class Vector2d; | |
16 | |
15 // Represents the widths of the four borders or margins of an unspecified | 17 // Represents the widths of the four borders or margins of an unspecified |
16 // rectangle. An Insets stores the thickness of the top, left, bottom and right | 18 // rectangle. An Insets stores the thickness of the top, left, bottom and right |
17 // edges, without storing the actual size and position of the rectangle itself. | 19 // edges, without storing the actual size and position of the rectangle itself. |
18 // | 20 // |
19 // This can be used to represent a space within a rectangle, by "shrinking" the | 21 // This can be used to represent a space within a rectangle, by "shrinking" the |
20 // rectangle by the inset amount on all four sides. Alternatively, it can | 22 // rectangle by the inset amount on all four sides. Alternatively, it can |
21 // represent a border that has a different thickness on each side. | 23 // represent a border that has a different thickness on each side. |
22 class GFX_EXPORT Insets { | 24 class GFX_EXPORT Insets { |
23 public: | 25 public: |
24 constexpr Insets() : top_(0), left_(0), bottom_(0), right_(0) {} | 26 constexpr Insets() : top_(0), left_(0), bottom_(0), right_(0) {} |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 inline Insets operator+(Insets lhs, const Insets& rhs) { | 113 inline Insets operator+(Insets lhs, const Insets& rhs) { |
112 lhs += rhs; | 114 lhs += rhs; |
113 return lhs; | 115 return lhs; |
114 } | 116 } |
115 | 117 |
116 inline Insets operator-(Insets lhs, const Insets& rhs) { | 118 inline Insets operator-(Insets lhs, const Insets& rhs) { |
117 lhs -= rhs; | 119 lhs -= rhs; |
118 return lhs; | 120 return lhs; |
119 } | 121 } |
120 | 122 |
123 GFX_EXPORT Insets operator+(const Insets& insets, const gfx::Vector2d& vector); | |
danakj
2016/10/28 18:44:59
So this moves the top/bottom and left/right insets
Evan Stade
2016/10/28 19:22:03
assuming it returns an Inset (unlike gfx::Rect::Of
danakj
2016/10/28 19:46:56
That would match the behaviour of Scale() so sure
Evan Stade
2016/10/28 20:12:10
done (unlike Scale, the impl is in the .cc file to
| |
124 | |
121 } // namespace gfx | 125 } // namespace gfx |
122 | 126 |
123 #endif // UI_GFX_GEOMETRY_INSETS_H_ | 127 #endif // UI_GFX_GEOMETRY_INSETS_H_ |
OLD | NEW |