summaryrefslogtreecommitdiff
ModeNameSize
-rw-r--r--.clang-format3400logplain
-rw-r--r--.clang-tidy60logplain
-rw-r--r--.gitignore79logplain
d---------.reuse32logplain
-rw-r--r--COPYING.rst3798logplain
d---------Documentation532logplain
d---------LICENSES518logplain
-rw-r--r--README.rst3880logplain
d---------include141logplain
-rw-r--r--meson.build6050logplain
-rw-r--r--meson_options.txt1708logplain
d---------package / gentoo / media-libs / libcamera33logplain
d---------src307logplain
d---------subprojects77logplain
d---------test1553logplain
d---------utils637logplain
pan class="hl ppc">#pragma once #include <algorithm> #include <ostream> #include <string> #include <libcamera/base/compiler.h> namespace libcamera { class Rectangle; class Point { public: constexpr Point() : x(0), y(0) { } constexpr Point(int xpos, int ypos) : x(xpos), y(ypos) { } int x; int y; const std::string toString() const; constexpr Point operator-() const { return { -x, -y }; } }; bool operator==(const Point &lhs, const Point &rhs); static inline bool operator!=(const Point &lhs, const Point &rhs) { return !(lhs == rhs); } std::ostream &operator<<(std::ostream &out, const Point &p); class Size { public: constexpr Size() : Size(0, 0) { } constexpr Size(unsigned int w, unsigned int h) : width(w), height(h) { } unsigned int width; unsigned int height; bool isNull() const { return !width && !height; } const std::string toString() const; Size &alignDownTo(unsigned int hAlignment, unsigned int vAlignment) { width = width / hAlignment * hAlignment; height = height / vAlignment * vAlignment; return *this; } Size &alignUpTo(unsigned int hAlignment, unsigned int vAlignment) { width = (width + hAlignment - 1) / hAlignment * hAlignment; height = (height + vAlignment - 1) / vAlignment * vAlignment; return *this; } Size &boundTo(const Size &bound) { width = std::min(width, bound.width); height = std::min(height, bound.height); return *this; } Size &expandTo(const Size &expand) { width = std::max(width, expand.width); height = std::max(height, expand.height); return *this; } Size &growBy(const Size &margins) { width += margins.width; height += margins.height; return *this; } Size &shrinkBy(const Size &margins) { width = width > margins.width ? width - margins.width : 0; height = height > margins.height ? height - margins.height : 0; return *this; } __nodiscard constexpr Size alignedDownTo(unsigned int hAlignment, unsigned int vAlignment) const { return { width / hAlignment * hAlignment, height / vAlignment * vAlignment }; } __nodiscard constexpr Size alignedUpTo(unsigned int hAlignment, unsigned int vAlignment) const { return {