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

Side by Side Diff: cc/geometry.h

Issue 11293193: ui: Add non-member Vector2dScale() and Vector3dScale() methods to create scaled vectors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review 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
« no previous file with comments | « no previous file | cc/layer_tree_host_impl_unittest.cc » ('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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 #ifndef CC_GEOMETRY_H_ 5 #ifndef CC_GEOMETRY_H_
6 #define CC_GEOMETRY_H_ 6 #define CC_GEOMETRY_H_
7 7
8 #include "ui/gfx/rect.h" 8 #include "ui/gfx/rect.h"
9 #include "ui/gfx/rect_f.h" 9 #include "ui/gfx/rect_f.h"
10 #include "ui/gfx/vector2d.h" 10 #include "ui/gfx/vector2d.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 inline gfx::Point BottomRight(gfx::Rect rect) { 60 inline gfx::Point BottomRight(gfx::Rect rect) {
61 return gfx::Point(rect.right(), rect.bottom()); 61 return gfx::Point(rect.right(), rect.bottom());
62 } 62 }
63 63
64 inline gfx::PointF BottomRight(gfx::RectF rect) { 64 inline gfx::PointF BottomRight(gfx::RectF rect) {
65 return gfx::PointF(rect.right(), rect.bottom()); 65 return gfx::PointF(rect.right(), rect.bottom());
66 } 66 }
67 67
68 // Return a vector that is |v| scaled by the given scale factors along each
69 // axis.
70 inline gfx::Vector2dF ScaleVector2d(gfx::Vector2dF v, float x_scale, float y_sca le) {
71 gfx::Vector2dF scaled = v;
72 scaled.Scale(x_scale, y_scale);
73 return scaled;
74 }
75
76 // Return a vector that is |v| scaled by the given scale factor.
77 inline gfx::Vector2dF ScaleVector2d(gfx::Vector2dF v, float scale) {
78 return ScaleVector2d(v, scale, scale);
79 }
80
81 } // namespace cc 68 } // namespace cc
82 69
83 #endif // CC_GEOMETRY_H_ 70 #endif // CC_GEOMETRY_H_
OLDNEW
« no previous file with comments | « no previous file | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698