1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/gfx/rect_f.h"
#include "base/logging.h"
#include "base/stringprintf.h"
#include "ui/gfx/insets_f.h"
#include "ui/gfx/rect_base_impl.h"
namespace gfx {
template class RectBase<RectF, PointF, SizeF, InsetsF, float>;
typedef class RectBase<RectF, PointF, SizeF, InsetsF, float> RectBaseT;
RectF::RectF() : RectBaseT(gfx::SizeF()) {
}
RectF::RectF(float width, float height)
: RectBaseT(gfx::SizeF(width, height)) {
}
RectF::RectF(float x, float y, float width, float height)
: RectBaseT(gfx::PointF(x, y), gfx::SizeF(width, height)) {
}
RectF::RectF(const gfx::SizeF& size)
: RectBaseT(size) {
}
RectF::RectF(const gfx::PointF& origin, const gfx::SizeF& size)
: RectBaseT(origin, size) {
}
RectF::~RectF() {}
Rect RectF::ToRect() const {
return Rect(origin().ToPoint(), size().ToSize());
}
std::string RectF::ToString() const {
return base::StringPrintf("%s %s",
origin().ToString().c_str(),
size().ToString().c_str());
}
} // namespace gfx
|