From 2b8171093a3728ea41f38f15e35b0d3a494ec730 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 14 Aug 2023 17:07:42 +0100 Subject: [PATCH] Change Colour constructors to be constexpr --- src/blitter/common.hpp | 2 +- src/gfx_type.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/blitter/common.hpp b/src/blitter/common.hpp index df002081f3..21b56bead7 100644 --- a/src/blitter/common.hpp +++ b/src/blitter/common.hpp @@ -21,7 +21,7 @@ #endif /** Cached black value. */ -static const Colour _black_colour(0, 0, 0); +static const constexpr Colour _black_colour(0, 0, 0); template void Blitter::DrawLineGeneric(int x1, int y1, int x2, int y2, int screen_width, int screen_height, int width, int dash, SetPixelT set_pixel) diff --git a/src/gfx_type.h b/src/gfx_type.h index e399eb79f0..62434cd2ac 100644 --- a/src/gfx_type.h +++ b/src/gfx_type.h @@ -180,7 +180,7 @@ union Colour { * @param b The channel for the blue colour. * @param a The channel for the alpha/transparency. */ - Colour(uint8 r, uint8 g, uint8 b, uint8 a = 0xFF) : + constexpr Colour(uint8 r, uint8 g, uint8 b, uint8 a = 0xFF) : #if defined(__EMSCRIPTEN__) r(r), g(g), b(b), a(a) #elif TTD_ENDIAN == TTD_BIG_ENDIAN @@ -195,7 +195,7 @@ union Colour { * Create a new colour. * @param data The colour in the correct packed format. */ - Colour(uint data = 0) : data(data) + constexpr Colour(uint data = 0) : data(data) { } };