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

Unified Diff: cc/math/int_size.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_size.h
diff --git a/cc/math/int_size.h b/cc/math/int_size.h
new file mode 100644
index 0000000000000000000000000000000000000000..5bfa1998468a2be205750b8b78231445fe90e246
--- /dev/null
+++ b/cc/math/int_size.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_SIZE_H_
+#define CC_MATH_INT_SIZE_H_
+
+namespace ccmath {
+
+class IntSize {
+public:
+ IntSize()
+ : m_width(0),
+ m_height(0) {
+ }
+ IntSize(int width, int height)
+ : m_width(width),
+ m_height(height) {
+ }
+ IntSize(const IntSize& size)
+ : m_width(size.m_width),
+ m_height(size.m_height) {
+ }
+
+ int width() const { return m_width; }
+ int height() const { return m_height; }
+
+ void set_width(int width) { m_width = width; }
+ void set_height(int height) { m_height = height; }
+
+ IntSize& ClampToNonNegative() {
+ m_width = m_width < 0 ? 0 : m_width;
+ m_height = m_height < 0 ? 0 : m_height;
+ return *this;
+ }
+
+ void ClampNegativeToZero();
+
+ bool IsEmpty() const;
+
+private:
+ int m_width;
+ int m_height;
+};
+
+inline bool operator==(const IntSize& a, const IntSize& b) {
+ return a.width() == b.width() && a.height() == b.height();
+}
+
+inline bool operator!=(const IntSize& a, const IntSize& b) {
+ return !(a == b);
+}
+
+} // namespace ccmath
+
+#endif // CC_MATH_INT_SIZE_H_
« cc/math/int_point.h ('K') | « cc/math/int_rect.cc ('k') | cc/math/int_size.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698