summaryrefslogtreecommitdiffstats
path: root/src/common/color.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/color.h')
-rw-r--r--src/common/color.h30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/common/color.h b/src/common/color.h
index 908879ea6..4ebd4f3d0 100644
--- a/src/common/color.h
+++ b/src/common/color.h
@@ -56,7 +56,7 @@ constexpr u8 Convert8To6(u8 value) {
* @return Result color decoded as Math::Vec4<u8>
*/
inline const Math::Vec4<u8> DecodeRGBA8(const u8* bytes) {
- return { bytes[3], bytes[2], bytes[1], bytes[0] };
+ return {bytes[3], bytes[2], bytes[1], bytes[0]};
}
/**
@@ -65,7 +65,7 @@ inline const Math::Vec4<u8> DecodeRGBA8(const u8* bytes) {
* @return Result color decoded as Math::Vec4<u8>
*/
inline const Math::Vec4<u8> DecodeRGB8(const u8* bytes) {
- return { bytes[2], bytes[1], bytes[0], 255 };
+ return {bytes[2], bytes[1], bytes[0], 255};
}
/**
@@ -74,7 +74,7 @@ inline const Math::Vec4<u8> DecodeRGB8(const u8* bytes) {
* @return Result color decoded as Math::Vec4<u8>
*/
inline const Math::Vec4<u8> DecodeRG8(const u8* bytes) {
- return { bytes[1], bytes[0], 0, 255 };
+ return {bytes[1], bytes[0], 0, 255};
}
/**
@@ -84,8 +84,8 @@ inline const Math::Vec4<u8> DecodeRG8(const u8* bytes) {
*/
inline const Math::Vec4<u8> DecodeRGB565(const u8* bytes) {
const u16_le pixel = *reinterpret_cast<const u16_le*>(bytes);
- return { Convert5To8((pixel >> 11) & 0x1F), Convert6To8((pixel >> 5) & 0x3F),
- Convert5To8(pixel & 0x1F), 255 };
+ return {Convert5To8((pixel >> 11) & 0x1F), Convert6To8((pixel >> 5) & 0x3F),
+ Convert5To8(pixel & 0x1F), 255};
}
/**
@@ -95,8 +95,8 @@ inline const Math::Vec4<u8> DecodeRGB565(const u8* bytes) {
*/
inline const Math::Vec4<u8> DecodeRGB5A1(const u8* bytes) {
const u16_le pixel = *reinterpret_cast<const u16_le*>(bytes);
- return { Convert5To8((pixel >> 11) & 0x1F), Convert5To8((pixel >> 6) & 0x1F),
- Convert5To8((pixel >> 1) & 0x1F), Convert1To8(pixel & 0x1) };
+ return {Convert5To8((pixel >> 11) & 0x1F), Convert5To8((pixel >> 6) & 0x1F),
+ Convert5To8((pixel >> 1) & 0x1F), Convert1To8(pixel & 0x1)};
}
/**
@@ -106,8 +106,8 @@ inline const Math::Vec4<u8> DecodeRGB5A1(const u8* bytes) {
*/
inline const Math::Vec4<u8> DecodeRGBA4(const u8* bytes) {
const u16_le pixel = *reinterpret_cast<const u16_le*>(bytes);
- return { Convert4To8((pixel >> 12) & 0xF), Convert4To8((pixel >> 8) & 0xF),
- Convert4To8((pixel >> 4) & 0xF), Convert4To8(pixel & 0xF) };
+ return {Convert4To8((pixel >> 12) & 0xF), Convert4To8((pixel >> 8) & 0xF),
+ Convert4To8((pixel >> 4) & 0xF), Convert4To8(pixel & 0xF)};
}
/**
@@ -134,7 +134,7 @@ inline u32 DecodeD24(const u8* bytes) {
* @return Resulting values stored as a Math::Vec2
*/
inline const Math::Vec2<u32> DecodeD24S8(const u8* bytes) {
- return { static_cast<u32>((bytes[2] << 16) | (bytes[1] << 8) | bytes[0]), bytes[3] };
+ return {static_cast<u32>((bytes[2] << 16) | (bytes[1] << 8) | bytes[0]), bytes[3]};
}
/**
@@ -175,8 +175,8 @@ inline void EncodeRG8(const Math::Vec4<u8>& color, u8* bytes) {
* @param bytes Destination pointer to store encoded color
*/
inline void EncodeRGB565(const Math::Vec4<u8>& color, u8* bytes) {
- *reinterpret_cast<u16_le*>(bytes) = (Convert8To5(color.r()) << 11) |
- (Convert8To6(color.g()) << 5) | Convert8To5(color.b());
+ *reinterpret_cast<u16_le*>(bytes) =
+ (Convert8To5(color.r()) << 11) | (Convert8To6(color.g()) << 5) | Convert8To5(color.b());
}
/**
@@ -186,7 +186,8 @@ inline void EncodeRGB565(const Math::Vec4<u8>& color, u8* bytes) {
*/
inline void EncodeRGB5A1(const Math::Vec4<u8>& color, u8* bytes) {
*reinterpret_cast<u16_le*>(bytes) = (Convert8To5(color.r()) << 11) |
- (Convert8To5(color.g()) << 6) | (Convert8To5(color.b()) << 1) | Convert8To1(color.a());
+ (Convert8To5(color.g()) << 6) |
+ (Convert8To5(color.b()) << 1) | Convert8To1(color.a());
}
/**
@@ -196,7 +197,8 @@ inline void EncodeRGB5A1(const Math::Vec4<u8>& color, u8* bytes) {
*/
inline void EncodeRGBA4(const Math::Vec4<u8>& color, u8* bytes) {
*reinterpret_cast<u16_le*>(bytes) = (Convert8To4(color.r()) << 12) |
- (Convert8To4(color.g()) << 8) | (Convert8To4(color.b()) << 4) | Convert8To4(color.a());
+ (Convert8To4(color.g()) << 8) |
+ (Convert8To4(color.b()) << 4) | Convert8To4(color.a());
}
/**