RDK Documentation (Open Sourced RDK Components)
intrect.h
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2018 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 #ifndef INTRECT_H
20 #define INTRECT_H
21 
22 class IntRect {
23  public:
24  IntRect()
25  : m_x(0), m_y(0), m_width(0), m_height(0) { }
26  IntRect(int x, int y, int width, int height)
27  : m_x(x), m_y(y), m_width(width), m_height(height) { }
28 
29  int x() const { return m_x; }
30  int y() const { return m_y; }
31  int width() const { return m_width; }
32  int height() const { return m_height; }
33 
34  private:
35  int m_x;
36  int m_y;
37  int m_width;
38  int m_height;
39 };
40 
41 inline bool operator==(const IntRect& a, const IntRect& b) {
42  return
43  a.x() == b.x() && a.y() == b.y() &&
44  a.width() == b.width() && a.height() == b.height();
45 }
46 
47 inline bool operator!=(const IntRect& a, const IntRect& b) {
48  return
49  a.x() != b.x() || a.y() != b.y() ||
50  a.width() != b.width() || a.height() != b.height();
51 }
52 
53 #endif // _INTRECT_H_
IntRect
Definition: intrect.h:22