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

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

Issue 11369043: ui: Create the gfx::QuadF class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use f suffix for floats Created 8 years, 1 month 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/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
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 float Vector2dF::Length() const { 45 float Vector2dF::Length() const {
46 return static_cast<float>(std::sqrt(LengthSquared())); 46 return static_cast<float>(std::sqrt(LengthSquared()));
47 } 47 }
48 48
49 void Vector2dF::Scale(float x_scale, float y_scale) { 49 void Vector2dF::Scale(float x_scale, float y_scale) {
50 x_ *= x_scale; 50 x_ *= x_scale;
51 y_ *= y_scale; 51 y_ *= y_scale;
52 } 52 }
53 53
54 double CrossProduct(const Vector2dF& lhs, const Vector2dF& rhs) {
55 return static_cast<double>(lhs.x()) * rhs.y() -
56 static_cast<double>(lhs.y()) * rhs.x();
57 }
58
59 double DotProduct(const Vector2dF& lhs, const Vector2dF& rhs) {
60 return static_cast<double>(lhs.x()) * rhs.x() +
61 static_cast<double>(lhs.y()) * rhs.y();
62 }
63
54 } // namespace gfx 64 } // namespace gfx
OLDNEW
« ui/gfx/quad_f.cc ('K') | « ui/gfx/vector2d_f.h ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698