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

Side by Side 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, 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_INT_SIZE_H_
6 #define CC_MATH_INT_SIZE_H_
7
8 namespace ccmath {
9
10 class IntSize {
11 public:
12 IntSize()
13 : m_width(0),
14 m_height(0) {
15 }
16 IntSize(int width, int height)
17 : m_width(width),
18 m_height(height) {
19 }
20 IntSize(const IntSize& size)
21 : m_width(size.m_width),
22 m_height(size.m_height) {
23 }
24
25 int width() const { return m_width; }
26 int height() const { return m_height; }
27
28 void set_width(int width) { m_width = width; }
29 void set_height(int height) { m_height = height; }
30
31 IntSize& ClampToNonNegative() {
32 m_width = m_width < 0 ? 0 : m_width;
33 m_height = m_height < 0 ? 0 : m_height;
34 return *this;
35 }
36
37 void ClampNegativeToZero();
38
39 bool IsEmpty() const;
40
41 private:
42 int m_width;
43 int m_height;
44 };
45
46 inline bool operator==(const IntSize& a, const IntSize& b) {
47 return a.width() == b.width() && a.height() == b.height();
48 }
49
50 inline bool operator!=(const IntSize& a, const IntSize& b) {
51 return !(a == b);
52 }
53
54 } // namespace ccmath
55
56 #endif // CC_MATH_INT_SIZE_H_
OLDNEW
« 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