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

Unified Diff: cc/math/float_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/float_size.h
diff --git a/cc/math/float_size.h b/cc/math/float_size.h
new file mode 100644
index 0000000000000000000000000000000000000000..71e3054ca6fd48a9ad4c3049393372c934c40341
--- /dev/null
+++ b/cc/math/float_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_FLOAT_SIZE_H_
+#define CC_MATH_FLOAT_SIZE_H_
+
+#include "cc/math/int_size.h"
+
+namespace ccmath {
+
+class FloatSize {
+public:
+ FloatSize()
+ : m_width(0),
+ m_height(0) {
+ }
+ FloatSize(float width, float height)
+ : m_width(width),
+ m_height(height) {
+ }
+ FloatSize(const FloatSize& size)
+ : m_width(size.m_width),
+ m_height(size.m_height) {
+ }
+ FloatSize(IntSize size)
+ : m_width(size.width()),
+ m_height(size.height()) {
+ }
+
+ float width() const { return m_width; }
+ float height() const { return m_height; }
+
+ void set_width(float width) { m_width = width; }
+ void set_height(float height) { m_height = height; }
+
+ void ClampToNonNegative();
+
+ bool IsEmpty() const;
+
+private:
+ float m_width;
+ float m_height;
+};
+
+inline bool operator==(const FloatSize& a, const FloatSize& b) {
+ return a.width() == b.width() && a.height() == b.height();
+}
+
+inline bool operator!=(const FloatSize& a, const FloatSize& b) {
+ return !(a == b);
+}
+
+} // namespace ccmath
+
+#endif // CC_MATH_FLOAT_SIZE_H_

Powered by Google App Engine
This is Rietveld 408576698