Change Colour constructors to be constexpr

pull/590/head
Jonathan G Rennison 10 months ago
parent 95f3cf2a8e
commit 2b8171093a

@ -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 <typename SetPixelT>
void Blitter::DrawLineGeneric(int x1, int y1, int x2, int y2, int screen_width, int screen_height, int width, int dash, SetPixelT set_pixel)

@ -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)
{
}
};

Loading…
Cancel
Save