| 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_
|
|
|