blob: 3840771cd18719455b203809e43848c656243e1c [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Isabella Gottardi6e464c32018-01-26 12:32:45 +00002 * Copyright (c) 2016-2018 ARM Limited.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003 *
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>
Isabella Gottardi6e464c32018-01-26 12:32:45 +000028#include <utility>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010029
30namespace arm_compute
31{
32/** Class for specifying the size of an image or rectangle */
33class Size2D
34{
35public:
36 /** Default constructor */
Isabella Gottardi6e464c32018-01-26 12:32:45 +000037 Size2D() = default;
Anthony Barbier6ff3b192017-09-04 18:44:23 +010038 /** Constructor. Initializes "width" and "height" respectively with "w" and "h"
39 *
40 * @param[in] w Width of the image or rectangle
41 * @param[in] h Height of the image or rectangle
42 */
43 Size2D(size_t w, size_t h)
44 : width(w), height(h)
45 {
46 }
Anthony Barbier6ff3b192017-09-04 18:44:23 +010047 /** The area of the image or rectangle calculated as (width * height)
48 *
49 * @return Area (width * height)
50 *
51 */
52 size_t area() const
53 {
54 return (width * height);
55 }
56
57public:
Isabella Gottardi6e464c32018-01-26 12:32:45 +000058 size_t width = {}; /**< Width of the image region or rectangle */
59 size_t height = {}; /**< Height of the image region or rectangle */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010060};
61}
62#endif /*__ARM_COMPUTE_SIZE2D_H__ */