Change Colour constructors to be constexpr
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Cached black value. */
|
/** Cached black value. */
|
||||||
static const Colour _black_colour(0, 0, 0);
|
static const constexpr Colour _black_colour(0, 0, 0);
|
||||||
|
|
||||||
template <typename SetPixelT>
|
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)
|
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 b The channel for the blue colour.
|
||||||
* @param a The channel for the alpha/transparency.
|
* @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__)
|
#if defined(__EMSCRIPTEN__)
|
||||||
r(r), g(g), b(b), a(a)
|
r(r), g(g), b(b), a(a)
|
||||||
#elif TTD_ENDIAN == TTD_BIG_ENDIAN
|
#elif TTD_ENDIAN == TTD_BIG_ENDIAN
|
||||||
@@ -195,7 +195,7 @@ union Colour {
|
|||||||
* Create a new colour.
|
* Create a new colour.
|
||||||
* @param data The colour in the correct packed format.
|
* @param data The colour in the correct packed format.
|
||||||
*/
|
*/
|
||||||
Colour(uint data = 0) : data(data)
|
constexpr Colour(uint data = 0) : data(data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user