blob: cb053ea2c463fdcb763288ed533edc5da8399c9b [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
2 * Copyright (c) 2016, 2017 ARM Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef __ARM_COMPUTE_SIZE2D_H__
25#define __ARM_COMPUTE_SIZE2D_H__
26
27#include <cstddef>
28
29namespace arm_compute
30{
31/** Class for specifying the size of an image or rectangle */
32class Size2D
33{
34public:
35 /** Default constructor */
36 Size2D()
37 : width(0), height(0)
38 {
39 }
40 /** Constructor. Initializes "width" and "height" respectively with "w" and "h"
41 *
42 * @param[in] w Width of the image or rectangle
43 * @param[in] h Height of the image or rectangle
44 */
45 Size2D(size_t w, size_t h)
46 : width(w), height(h)
47 {
48 }
49 /** Constructor. Initializes "width" and "height" with the dimensions of "size"
50 *
51 * @param[in] size Size data object
52 */
53 Size2D(const Size2D &size)
54 : width(size.width), height(size.height)
55 {
56 }
57 /** Copy assignment
58 *
59 * @param[in] size Constant reference input "Size2D" data object to copy
60 *
61 * @return Reference to the newly altered left hand side "Size2D" data object
62 */
63 Size2D &operator=(const Size2D &size)
64 {
65 width = size.width;
66 height = size.height;
67 return *this;
68 }
69 /** The area of the image or rectangle calculated as (width * height)
70 *
71 * @return Area (width * height)
72 *
73 */
74 size_t area() const
75 {
76 return (width * height);
77 }
78
79public:
80 size_t width; /**< Width of the image region or rectangle */
81 size_t height; /**< Height of the image region or rectangle */
82};
83}
84#endif /*__ARM_COMPUTE_SIZE2D_H__ */