Files
MapLibreParticleLab/include/mbgl/util/size.hpp
Bart Louwers 550f64be22 core: rename mbgl namespace to mln (#4487)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-08-14 23:25:20 +02:00

34 lines
797 B
C++

#pragma once
#include <cstdint>
namespace mln {
class Size {
public:
constexpr Size() = default;
constexpr Size(const uint32_t width_, const uint32_t height_) noexcept
: width(width_),
height(height_) {}
constexpr uint32_t area() const noexcept { return width * height; }
constexpr float aspectRatio() const noexcept { return static_cast<float>(width) / static_cast<float>(height); }
constexpr bool isEmpty() const noexcept { return width == 0 || height == 0; }
uint32_t width = 0;
uint32_t height = 0;
};
constexpr bool operator==(const Size& a, const Size& b) noexcept {
return a.width == b.width && a.height == b.height;
}
constexpr bool operator!=(const Size& a, const Size& b) noexcept {
return !(a == b);
}
} // namespace mln