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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/font_atlas.cc ('k') | cc/gl_renderer.h » ('j') | cc/layer_quad.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/geometry.h
diff --git a/cc/geometry.h b/cc/geometry.h
new file mode 100644
index 0000000000000000000000000000000000000000..b4c45ee4dd65909e2defb9abac033f1290ad0cac
--- /dev/null
+++ b/cc/geometry.h
@@ -0,0 +1,29 @@
+// Copyright 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_GEOMETRY_H_
+#define CC_GEOMETRY_H_
+
+#include "ui/gfx/size.h"
+#include "ui/gfx/vector2d_f.h"
+#include <cmath>
+
+namespace cc {
+
+inline gfx::Size ClampSizeFromAbove(gfx::Size s, gfx::Size other) {
+ return gfx::Size(s.width() < other.width() ? s.width() : other.width(),
+ s.height() < other.height() ? s.height() : other.height());
+}
+
+inline float LengthSquared(gfx::Vector2dF v) {
+ return v.x() * v.x() + v.y() * v.y();
+}
+
+inline float Length(gfx::Vector2dF v) {
+ return std::sqrt(LengthSquared(v));
+}
+
+} // namespace cc
+
+#endif // CC_GEOMETRY_H_
« 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