1/*
2 * Copyright@ Samsung Electronics Co. LTD
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15*/
16
17/*!
18 * \file      ExynosRect.h
19 * \brief     header file for ExynosRect
20 * \author    Sangwoo, Park(sw5771.park@samsung.com)
21 * \date      2011/06/02
22 *
23 * <b>Revision History: </b>
24 * - 2010/06/03 : Sangwoo, Park(sw5771.park@samsung.com) \n
25 *   Initial version
26 *
27 * - 2012/03/14 : sangwoo.park(sw5771.park@samsung.com) \n
28 *   Change file, struct name to ExynosXXX.
29 *
30 */
31
32#ifndef EXYNOS_RECT_H_
33#define EXYNOS_RECT_H_
34
35//! Rectangle information
36/*!
37 * \ingroup Exynos
38 */
39struct ExynosRect
40{
41    int x;           //!< x pos
42    int y;           //!< y pos
43    int w;           //!< width
44    int h;           //!< height
45    int fullW;       //!< full width of image
46    int fullH;       //!< full height of image
47    int colorFormat; //!< V4L2_PIX_FMT_XXX
48
49#ifdef __cplusplus
50    //! Constructor
51    ExynosRect(int _x_ = 0,
52            int _y_ = 0,
53            int _w_ = 0,
54            int _h_ = 0,
55            int _fullW_ = 0,
56            int _fullH_ = 0,
57            int _colorFormat_ = 0)
58    {
59        x = _x_;
60        y = _y_;
61        w = _w_;
62        h = _h_;
63        fullW = _fullW_;
64        fullH = _fullH_;
65        colorFormat = _colorFormat_;
66    }
67
68    //! Constructor
69    ExynosRect(const ExynosRect *other)
70    {
71        x           = other->x;
72        y           = other->y;
73        w           = other->w;
74        h           = other->h;
75        fullW       = other->fullW;
76        fullH       = other->fullH;
77        colorFormat = other->colorFormat;
78    }
79
80    //! Operator(=) override
81    ExynosRect& operator =(const ExynosRect &other)
82    {
83        x           = other.x;
84        y           = other.y;
85        w           = other.w;
86        h           = other.h;
87        fullW       = other.fullW;
88        fullH       = other.fullH;
89        colorFormat = other.colorFormat;
90        return *this;
91    }
92
93    //! Operator(==) override
94    bool operator ==(const ExynosRect &other) const
95    {
96        return (   x           == other.x
97                && y           == other.y
98                && w           == other.w
99                && h           == other.h
100                && fullW       == other.fullW
101                && fullH       == other.fullH
102                && colorFormat == other.colorFormat);
103    }
104
105    //! Operator(!=) override
106    bool operator !=(const ExynosRect &other) const
107    {
108        // use operator(==)
109        return !(*this == other);
110    }
111#endif
112};
113
114//! Clip information
115/*!
116 * \ingroup Exynos
117 */
118struct ExynosRect2
119{
120    int x1; //!< Left   (The x-coordinate value of upper-left corner)
121    int y1; //!< Top    (The y-coordinate value of upper-left corner)
122    int x2; //!< Right  (The x-coordinate value of lower-right corner)
123    int y2; //!< Bottom (The y-coordinate value of lower-right corner)
124
125#ifdef __cplusplus
126    //! Constructor
127    ExynosRect2(int _x1_ = 0, int _y1_ = 0, int _x2_ = 0, int _y2_ = 0)
128    {
129        x1 = _x1_;
130        y1 = _y1_;
131        x2 = _x2_;
132        y2 = _y2_;
133    }
134
135    //! Constructor
136    ExynosRect2(const ExynosRect2 *other)
137    {
138        x1 = other->x1;
139        y1 = other->y1;
140        x2 = other->x2;
141        y2 = other->y2;
142    }
143
144    //! Operator(=) override
145    ExynosRect2& operator =(const ExynosRect2 &other)
146    {
147        x1 = other.x1;
148        y1 = other.y1;
149        x2 = other.x2;
150        y2 = other.y2;
151        return *this;
152    }
153
154    //! Operator(==) override
155    bool operator ==(const ExynosRect2 &other) const
156    {
157        return (   x1 == other.x1
158                && y1 == other.y1
159                && x2 == other.x2
160                && y2 == other.y2);
161    }
162
163    //! Operator(!=) override
164    bool operator !=(const ExynosRect2 &other) const
165    {
166        // use operator(==)
167        return !(*this == other);
168    }
169#endif
170};
171
172#endif //EXYNOS_RECT_H_
173