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

Side by Side Diff: cc/geometry.h

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some missed intstuff 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_GEOMETRY_H_
6 #define CC_GEOMETRY_H_
7
8 #include "ui/gfx/size.h"
9 #include "ui/gfx/vector2d_f.h"
10 #include <cmath>
11
12 namespace cc {
13
14 inline gfx::Size ClampSizeFromAbove(gfx::Size s, gfx::Size other) {
15 return gfx::Size(s.width() < other.width() ? s.width() : other.width(),
16 s.height() < other.height() ? s.height() : other.height());
17 }
18
19 inline float LengthSquared(gfx::Vector2dF v) {
20 return v.x() * v.x() + v.y() * v.y();
21 }
22
23 inline float Length(gfx::Vector2dF v) {
24 return std::sqrt(LengthSquared(v));
25 }
26
27 } // namespace cc
28
29 #endif // CC_GEOMETRY_H_
OLDNEW
« no previous file with comments | « cc/font_atlas.cc ('k') | cc/gl_renderer.h » ('j') | cc/layer_quad.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698