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

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: 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
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> 7 #include <cmath>
8 8
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "ui/gfx/point.h"
11 10
12 namespace gfx { 11 namespace gfx {
13 12
14 template class PointBase<PointF, float>; 13 template class PointBase<PointF, float>;
15 14
16 PointF::PointF() : PointBase<PointF, float>(0, 0) { 15 PointF::PointF() : PointBase<PointF, float>(0, 0) {
17 } 16 }
18 17
19 PointF::PointF(float x, float y) : PointBase<PointF, float>(x, y) { 18 PointF::PointF(float x, float y) : PointBase<PointF, float>(x, y) {
20 } 19 }
21 20
22 Point PointF::ToPoint() const { 21 PointF::~PointF() {}
23 return Point(static_cast<int>(std::floor(x())),
24 static_cast<int>(std::floor(y())));
25 }
26 22
27 std::string PointF::ToString() const { 23 std::string PointF::ToString() const {
28 return base::StringPrintf("%f,%f", x(), y()); 24 return base::StringPrintf("%f,%f", x(), y());
29 } 25 }
30 26
31 } // namespace gfx 27 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698