Fixes cases where we incorrectly convert from RectF to Rect by flooring. In all cases...
[chromium-blink-merge.git] / ui / gfx / rect_f.cc
blob85039244789099ed8f6922e520a31469ea7d6f24
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 #include "ui/gfx/rect_f.h"
7 #include "base/logging.h"
8 #include "base/stringprintf.h"
9 #include "ui/gfx/insets_f.h"
10 #include "ui/gfx/rect_base_impl.h"
12 namespace gfx {
14 template class RectBase<RectF, PointF, SizeF, InsetsF, float>;
16 typedef class RectBase<RectF, PointF, SizeF, InsetsF, float> RectBaseT;
18 RectF::RectF() : RectBaseT(gfx::SizeF()) {
21 RectF::RectF(float width, float height)
22 : RectBaseT(gfx::SizeF(width, height)) {
25 RectF::RectF(float x, float y, float width, float height)
26 : RectBaseT(gfx::PointF(x, y), gfx::SizeF(width, height)) {
29 RectF::RectF(const gfx::SizeF& size)
30 : RectBaseT(size) {
33 RectF::RectF(const gfx::PointF& origin, const gfx::SizeF& size)
34 : RectBaseT(origin, size) {
37 RectF::~RectF() {}
39 std::string RectF::ToString() const {
40 return base::StringPrintf("%s %s",
41 origin().ToString().c_str(),
42 size().ToString().c_str());
45 } // namespace gfx