1#pragma once
2
3#include <cstdint>
4#include <array>
5
6namespace mbgl {
7
8class Size {
9public:
10 constexpr Size() = default;
11
12 constexpr Size(const uint32_t width_, const uint32_t height_) : width(width_), height(height_) {
13 }
14
15 constexpr uint32_t area() const {
16 return width * height;
17 }
18
19 constexpr float aspectRatio() const {
20 return static_cast<float>(width) / static_cast<float>(height);
21 }
22
23 constexpr bool isEmpty() const {
24 return width == 0 || height == 0;
25 }
26
27 uint32_t width = 0;
28 uint32_t height = 0;
29};
30
31constexpr inline bool operator==(const Size& a, const Size& b) {
32 return a.width == b.width && a.height == b.height;
33}
34
35constexpr inline bool operator!=(const Size& a, const Size& b) {
36 return !(a == b);
37}
38
39} // namespace mbgl
40

source code of qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/size.hpp