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

Unified Diff: cc/math/int_point.h

Issue 10984053: cc: Use ui/gfx geometry types for the CCRenderPass and CCDrawQuad classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
Index: cc/math/int_point.h
diff --git a/cc/math/int_point.h b/cc/math/int_point.h
new file mode 100644
index 0000000000000000000000000000000000000000..4584ce1e00861a4c72e6b12cde5a4c03563d17f4
--- /dev/null
+++ b/cc/math/int_point.h
@@ -0,0 +1,56 @@
+// Copyright 2012 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_MATH_INT_POINT_H_
+#define CC_MATH_INT_POINT_H_
+
+#include "cc/math/int_vector_2d.h"
+
+namespace ccmath {
+
+class IntPoint {
+public:
tfarina 2012/09/28 19:39:30 if this were to follow chromium coding style, this
+ IntPoint()
+ : m_x(0),
+ m_y(0) {
+ }
+ IntPoint(int x, int y)
+ : m_x(x),
+ m_y(y) {
+ }
+ IntPoint(const IntPoint& point)
+ : m_x(point.m_x),
+ m_y(point.m_y) {
+ }
+
+ int x() const { return m_x; }
+ int y() const { return m_y; }
+
+ void set_x(int x) { m_x = x; }
+ void set_y(int y) { m_y = y; }
+
+private:
+ int m_x;
tfarina 2012/09/28 19:39:30 and thus this would have to be |x_|
+ int m_y;
+};
+
+inline bool operator==(const IntPoint& a, const IntPoint& b) {
+ return a.x() == b.x() && a.y() == b.y();
+}
+
+inline bool operator!=(const IntPoint& a, const IntPoint& b) {
+ return !(a == b);
+}
+
+inline IntPoint operator+(const IntPoint& p, const IntVector2d& v) {
+ return IntPoint(p.x() + v.v1(), p.y() + v.v2());
+}
+
+inline IntVector2d operator-(const IntPoint& a, const IntPoint& b) {
+ return IntVector2d(a.x() - b.x(), a.y() - b.y());
+}
+
+} // namespace ccmath
tfarina 2012/09/28 19:39:30 } // namespace ccmatch ^ two spaces between } a
+
+#endif // CC_MATH_INT_POINT_H_
« cc/math/clamp.h ('K') | « cc/math/float_vector_2d.h ('k') | cc/math/int_rect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698