OLD | NEW |
| (Empty) |
1 // Copyright 2010 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can | |
3 // be found in the LICENSE file. | |
4 | |
5 #ifndef C_SALT_RECT_H_ | |
6 #define C_SALT_RECT_H_ | |
7 | |
8 namespace c_salt { | |
9 class Size { | |
10 public: | |
11 Size() : width_(0), height_(0) {} | |
12 Size(int w, int h) : width_(w), height_(h) {} | |
13 | |
14 int width() const {return width_;} | |
15 int height() const {return height_;} | |
16 | |
17 int width_; | |
18 int height_; | |
19 }; | |
20 | |
21 class Rect { | |
22 public: | |
23 Rect() : left_(0), top_(0), right_(0), bottom_(0) {} | |
24 Rect(int left, int top, int right, int bottom); | |
25 Rect(int width, int height); | |
26 explicit Rect(Size size); | |
27 | |
28 int width() const {return right_ - left_;} | |
29 int height() const {return bottom_ - top_;} | |
30 | |
31 bool Empty() const; | |
32 void Deflate(int sz); | |
33 void ShrinkToFit(const Rect& dest); | |
34 void CenterIn(const Rect& dest); | |
35 void MoveBy(int dx, int dy); | |
36 | |
37 int left_; | |
38 int top_; | |
39 int right_; | |
40 int bottom_; | |
41 }; | |
42 } // namespace c_salt | |
43 #endif // C_SALT_RECT_H_ | |
44 | |
OLD | NEW |