aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bmpimage.hpp34
-rw-r--r--include/common.hpp2
-rw-r--r--include/ui.hpp34
3 files changed, 36 insertions, 34 deletions
diff --git a/include/bmpimage.hpp b/include/bmpimage.hpp
new file mode 100644
index 0000000..69b78ac
--- /dev/null
+++ b/include/bmpimage.hpp
@@ -0,0 +1,34 @@
+#ifndef BMP_IMAGE_HPP
+#define BMP_IMAGE_HPP
+
+#include <cstdint>
+
+/**
+ * Defines the layout of a bitmap (.bmp) file's header.
+ */
+typedef struct {
+ uint16_t bfType;
+ uint32_t bfSize;
+ uint16_t bfReserved1;
+ uint16_t bfReserved2;
+ uint32_t bfOffBits;
+} __attribute__((packed)) BITMAPFILEHEADER;
+
+/**
+ * Defines the layout of a bitmap's info header.
+ */
+typedef struct {
+ uint32_t biSize;
+ int32_t biWidth;
+ int32_t biHeight;
+ uint16_t biPlanes;
+ uint16_t biBitCount;
+ uint32_t biCompression;
+ uint32_t biSizeImage;
+ int32_t biXPelsPerMeter;
+ int32_t biYPelsPerMeter;
+ uint32_t biClrUsed;
+ uint32_t biClrImportant;
+} __attribute__((packed)) BITMAPINFOHEADER;
+
+#endif // BMP_IMAGE_HPP
diff --git a/include/common.hpp b/include/common.hpp
index 73b4928..e082a87 100644
--- a/include/common.hpp
+++ b/include/common.hpp
@@ -240,7 +240,7 @@ void UserError(std::string reason);
namespace std {
template<class T>
constexpr const T& clamp(const T& v, const T& lo, const T& hi) {
- return (v > hi) ? ((v > lo) ? v : lo) : hi;
+ return (v > hi) ? hi : ((v > lo) ? v : lo);
}
}
diff --git a/include/ui.hpp b/include/ui.hpp
index 67406f4..099bebf 100644
--- a/include/ui.hpp
+++ b/include/ui.hpp
@@ -32,40 +32,8 @@
#include <ft2build.h>
#include FT_FREETYPE_H
-/* ----------------------------------------------------------------------------
-** Structures section
-** --------------------------------------------------------------------------*/
-
#ifndef __WIN32__
-
-/**
- * Defines the layout of a bitmap (.bmp) file's header.
- */
-typedef struct {
- uint16_t bfType;
- uint32_t bfSize;
- uint16_t bfReserved1;
- uint16_t bfReserved2;
- uint32_t bfOffBits;
-} __attribute__((packed)) BITMAPFILEHEADER;
-
-/**
- * Defines the layout of a bitmap's info header.
- */
-typedef struct {
- uint32_t biSize;
- int32_t biWidth;
- int32_t biHeight;
- uint16_t biPlanes;
- uint16_t biBitCount;
- uint32_t biCompression;
- uint32_t biSizeImage;
- int32_t biXPelsPerMeter;
- int32_t biYPelsPerMeter;
- uint32_t biClrUsed;
- uint32_t biClrImportant;
-} __attribute__((packed)) BITMAPINFOHEADER;
-
+# include <bmpimage.hpp>
#endif // __WIN32__
/* ----------------------------------------------------------------------------