Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / gfx / geometry / insets.h
blob6e9c70bd89c1106002e9ca8ef4e927e5679bbddb
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_
8 #include <string>
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"
15 namespace gfx {
17 // An integer version of gfx::Insets.
18 class GFX_EXPORT Insets : public InsetsBase<Insets, int> {
19 public:
20 Insets();
21 Insets(int top, int left, int bottom, int right);
23 ~Insets();
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>;
47 #endif
49 } // namespace gfx
51 #endif // UI_GFX_GEOMETRY_INSETS_H_