Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Side by Side Diff: ui/gfx/point_f.cc

Issue 10993094: Make adding and subtracting gfx:: point types simpler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/point_f.h ('k') | ui/gfx/rect.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/point_f.h" 5 #include "ui/gfx/point_f.h"
6 6
7 #include <cmath>
8
9 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
10 #include "ui/gfx/point.h"
11 8
12 namespace gfx { 9 namespace gfx {
13 10
14 template class PointBase<PointF, float>; 11 template class PointBase<PointF, float>;
15 12
16 PointF::PointF() : PointBase<PointF, float>(0, 0) { 13 PointF::PointF() : PointBase<PointF, float>(0, 0) {
17 } 14 }
18 15
19 PointF::PointF(float x, float y) : PointBase<PointF, float>(x, y) { 16 PointF::PointF(float x, float y) : PointBase<PointF, float>(x, y) {
20 } 17 }
21 18
22 Point PointF::ToPoint() const { 19 PointF::~PointF() {}
23 return Point(static_cast<int>(std::floor(x())),
24 static_cast<int>(std::floor(y())));
25 }
26 20
27 std::string PointF::ToString() const { 21 std::string PointF::ToString() const {
28 return base::StringPrintf("%f,%f", x(), y()); 22 return base::StringPrintf("%f,%f", x(), y());
29 } 23 }
30 24
31 } // namespace gfx 25 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/point_f.h ('k') | ui/gfx/rect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698