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
3 // found in the LICENSE file.
5 #ifndef UI_GFX_GEOMETRY_INSETS_H_
6 #define UI_GFX_GEOMETRY_INSETS_H_
10 #include "build/build_config.h"
11 #include "ui/gfx/geometry/insets_base.h"
12 #include "ui/gfx/geometry/insets_f.h"
13 #include "ui/gfx/gfx_export.h"
17 // An integer version of gfx::Insets.
18 class GFX_EXPORT Insets
: public InsetsBase
<Insets
, int> {
21 Insets(int top
, int left
, int bottom
, int right
);
25 Insets
Scale(float scale
) const {
26 return Scale(scale
, scale
);
29 Insets
Scale(float x_scale
, float y_scale
) const {
30 return Insets(static_cast<int>(top() * y_scale
),
31 static_cast<int>(left() * x_scale
),
32 static_cast<int>(bottom() * y_scale
),
33 static_cast<int>(right() * x_scale
));
36 operator InsetsF() const {
37 return InsetsF(static_cast<float>(top()), static_cast<float>(left()),
38 static_cast<float>(bottom()), static_cast<float>(right()));
41 // Returns a string representation of the insets.
42 std::string
ToString() const;
45 #if !defined(COMPILER_MSVC) && !defined(__native_client__)
46 extern template class InsetsBase
<Insets
, int>;
51 #endif // UI_GFX_GEOMETRY_INSETS_H_