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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_MATH_FLOAT_SIZE_H_
6 #define CC_MATH_FLOAT_SIZE_H_
7
8 #include "cc/math/int_size.h"
9
10 namespace ccmath {
11
12 class FloatSize {
13 public:
14 FloatSize()
15 : m_width(0),
16 m_height(0) {
17 }
18 FloatSize(float width, float height)
19 : m_width(width),
20 m_height(height) {
21 }
22 FloatSize(const FloatSize& size)
23 : m_width(size.m_width),
24 m_height(size.m_height) {
25 }
26 FloatSize(IntSize size)
27 : m_width(size.width()),
28 m_height(size.height()) {
29 }
30
31 float width() const { return m_width; }
32 float height() const { return m_height; }
33
34 void set_width(float width) { m_width = width; }
35 void set_height(float height) { m_height = height; }
36
37 void ClampToNonNegative();
38
39 bool IsEmpty() const;
40
41 private:
42 float m_width;
43 float m_height;
44 };
45
46 inline bool operator==(const FloatSize& a, const FloatSize& b) {
47 return a.width() == b.width() && a.height() == b.height();
48 }
49
50 inline bool operator!=(const FloatSize& a, const FloatSize& b) {
51 return !(a == b);
52 }
53
54 } // namespace ccmath
55
56 #endif // CC_MATH_FLOAT_SIZE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698