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

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

Issue 11414284: Inline gfx::Vector2d* ctors and integer conversions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile Created 8 years 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/vector2d_f.h ('k') | ui/ui.gyp » ('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/vector2d_f.h" 5 #include "ui/gfx/vector2d_f.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 10
11 namespace gfx { 11 namespace gfx {
12 12
13 Vector2dF::Vector2dF()
14 : x_(0),
15 y_(0) {
16 }
17
18 Vector2dF::Vector2dF(float x, float y)
19 : x_(x),
20 y_(y) {
21 }
22
23 std::string Vector2dF::ToString() const { 13 std::string Vector2dF::ToString() const {
24 return base::StringPrintf("[%f %f]", x_, y_); 14 return base::StringPrintf("[%f %f]", x_, y_);
25 } 15 }
26 16
27 bool Vector2dF::IsZero() const { 17 bool Vector2dF::IsZero() const {
28 return x_ == 0 && y_ == 0; 18 return x_ == 0 && y_ == 0;
29 } 19 }
30 20
31 void Vector2dF::Add(const Vector2dF& other) { 21 void Vector2dF::Add(const Vector2dF& other) {
32 x_ += other.x_; 22 x_ += other.x_;
(...skipping 28 matching lines...) Expand all
61 static_cast<double>(lhs.y()) * rhs.y(); 51 static_cast<double>(lhs.y()) * rhs.y();
62 } 52 }
63 53
64 Vector2dF ScaleVector2d(const Vector2dF& v, float x_scale, float y_scale) { 54 Vector2dF ScaleVector2d(const Vector2dF& v, float x_scale, float y_scale) {
65 Vector2dF scaled_v(v); 55 Vector2dF scaled_v(v);
66 scaled_v.Scale(x_scale, y_scale); 56 scaled_v.Scale(x_scale, y_scale);
67 return scaled_v; 57 return scaled_v;
68 } 58 }
69 59
70 } // namespace gfx 60 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/vector2d_f.h ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698