Chromium Code Reviews| 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 #include "ui/gfx/rect_f.h" | 5 #include "ui/gfx/rect_f.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "ui/gfx/insets_f.h" | 9 #include "ui/gfx/insets_f.h" |
| 10 #include "ui/gfx/rect_base_impl.h" | 10 #include "ui/gfx/rect_base_impl.h" |
| 11 #include "ui/gfx/safe_floor_ceil.h" | |
|
sky
2012/09/27 20:33:55
Is this needed?
| |
| 11 | 12 |
| 12 namespace gfx { | 13 namespace gfx { |
| 13 | 14 |
| 14 template class RectBase<RectF, PointF, SizeF, InsetsF, float>; | 15 template class RectBase<RectF, PointF, SizeF, InsetsF, float>; |
| 15 | 16 |
| 16 typedef class RectBase<RectF, PointF, SizeF, InsetsF, float> RectBaseT; | 17 typedef class RectBase<RectF, PointF, SizeF, InsetsF, float> RectBaseT; |
| 17 | 18 |
| 18 RectF::RectF() : RectBaseT(gfx::SizeF()) { | 19 RectF::RectF() : RectBaseT(gfx::SizeF()) { |
| 19 } | 20 } |
| 20 | 21 |
| 21 RectF::RectF(float width, float height) | 22 RectF::RectF(float width, float height) |
| 22 : RectBaseT(gfx::SizeF(width, height)) { | 23 : RectBaseT(gfx::SizeF(width, height)) { |
| 23 } | 24 } |
| 24 | 25 |
| 25 RectF::RectF(float x, float y, float width, float height) | 26 RectF::RectF(float x, float y, float width, float height) |
| 26 : RectBaseT(gfx::PointF(x, y), gfx::SizeF(width, height)) { | 27 : RectBaseT(gfx::PointF(x, y), gfx::SizeF(width, height)) { |
| 27 } | 28 } |
| 28 | 29 |
| 29 RectF::RectF(const gfx::SizeF& size) | 30 RectF::RectF(const gfx::SizeF& size) |
| 30 : RectBaseT(size) { | 31 : RectBaseT(size) { |
| 31 } | 32 } |
| 32 | 33 |
| 33 RectF::RectF(const gfx::PointF& origin, const gfx::SizeF& size) | 34 RectF::RectF(const gfx::PointF& origin, const gfx::SizeF& size) |
| 34 : RectBaseT(origin, size) { | 35 : RectBaseT(origin, size) { |
| 35 } | 36 } |
| 36 | 37 |
| 37 RectF::~RectF() {} | 38 RectF::~RectF() {} |
| 38 | 39 |
| 39 Rect RectF::ToRect() const { | |
| 40 return Rect(origin().ToPoint(), size().ToSize()); | |
| 41 } | |
| 42 | |
| 43 std::string RectF::ToString() const { | 40 std::string RectF::ToString() const { |
| 44 return base::StringPrintf("%s %s", | 41 return base::StringPrintf("%s %s", |
| 45 origin().ToString().c_str(), | 42 origin().ToString().c_str(), |
| 46 size().ToString().c_str()); | 43 size().ToString().c_str()); |
| 47 } | 44 } |
| 48 | 45 |
| 49 } // namespace gfx | 46 } // namespace gfx |
| OLD | NEW |