summaryrefslogtreecommitdiff
path: root/src/common/color.h
diff options
context:
space:
mode:
authorGravatar Emmanuel Gil Peyrot2016-09-18 09:38:01 +0900
committerGravatar Emmanuel Gil Peyrot2016-09-18 09:38:01 +0900
commitdc8479928c5aee4c6ad6fe4f59006fb604cee701 (patch)
tree569a7f13128450bbab973236615587ff00bced5f /src/common/color.h
parentTravis: Import Dolphin’s clang-format hook. (diff)
downloadyuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.gz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.xz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.zip
Sources: Run clang-format on everything.
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) {
56 * @return Result color decoded as Math::Vec4<u8> 56 * @return Result color decoded as Math::Vec4<u8>
57 */ 57 */
58inline const Math::Vec4<u8> DecodeRGBA8(const u8* bytes) { 58inline const Math::Vec4<u8> DecodeRGBA8(const u8* bytes) {
59 return { bytes[3], bytes[2], bytes[1], bytes[0] }; 59 return {bytes[3], bytes[2], bytes[1], bytes[0]};
60} 60}
61 61
62/** 62/**
@@ -65,7 +65,7 @@ inline const Math::Vec4<u8> DecodeRGBA8(const u8* bytes) {
65 * @return Result color decoded as Math::Vec4<u8> 65 * @return Result color decoded as Math::Vec4<u8>
66 */ 66 */
67inline const Math::Vec4<u8> DecodeRGB8(const u8* bytes) { 67inline const Math::Vec4<u8> DecodeRGB8(const u8* bytes) {
68 return { bytes[2], bytes[1], bytes[0], 255 }; 68 return {bytes[2], bytes[1], bytes[0], 255};
69} 69}
70 70
71/** 71/**
@@ -74,7 +74,7 @@ inline const Math::Vec4<u8> DecodeRGB8(const u8* bytes) {
74 * @return Result color decoded as Math::Vec4<u8> 74 * @return Result color decoded as Math::Vec4<u8>
75 */ 75 */
76inline const Math::Vec4<u8> DecodeRG8(const u8* bytes) { 76inline const Math::Vec4<u8> DecodeRG8(const u8* bytes) {
77 return { bytes[1], bytes[0], 0, 255 }; 77 return {bytes[1], bytes[0], 0, 255};
78} 78}
79 79
80/** 80/**
@@ -84,8 +84,8 @@ inline const Math::Vec4<u8> DecodeRG8(const u8* bytes) {
84 */ 84 */
85inline const Math::Vec4<u8> DecodeRGB565(const u8* bytes) { 85inline const Math::Vec4<u8> DecodeRGB565(const u8* bytes) {
86 const u16_le pixel = *reinterpret_cast<const u16_le*>(bytes); 86 const u16_le pixel = *reinterpret_cast<const u16_le*>(bytes);
87 return { Convert5To8((pixel >> 11) & 0x1F), Convert6To8((pixel >> 5) & 0x3F), 87 return {Convert5To8((pixel >> 11) & 0x1F), Convert6To8((pixel >> 5) & 0x3F),
88 Convert5To8(pixel & 0x1F), 255 }; 88 Convert5To8(pixel & 0x1F), 255};
89} 89}
90 90
91/** 91/**
@@ -95,8 +95,8 @@ inline const Math::Vec4<u8> DecodeRGB565(const u8* bytes) {
95 */ 95 */
96inline const Math::Vec4<u8> DecodeRGB5A1(const u8* bytes) { 96inline const Math::Vec4<u8> DecodeRGB5A1(const u8* bytes) {
97 const u16_le pixel = *reinterpret_cast<const u16_le*>(bytes); 97 const u16_le pixel = *reinterpret_cast<const u16_le*>(bytes);
98 return { Convert5To8((pixel >> 11) & 0x1F), Convert5To8((pixel >> 6) & 0x1F), 98 return {Convert5To8((pixel >> 11) & 0x1F), Convert5To8((pixel >> 6) & 0x1F),
99 Convert5To8((pixel >> 1) & 0x1F), Convert1To8(pixel & 0x1) }; 99 Convert5To8((pixel >> 1) & 0x1F), Convert1To8(pixel & 0x1)};
100} 100}
101 101
102/** 102/**
@@ -106,8 +106,8 @@ inline const Math::Vec4<u8> DecodeRGB5A1(const u8* bytes) {
106 */ 106 */
107inline const Math::Vec4<u8> DecodeRGBA4(const u8* bytes) { 107inline const Math::Vec4<u8> DecodeRGBA4(const u8* bytes) {
108 const u16_le pixel = *reinterpret_cast<const u16_le*>(bytes); 108 const u16_le pixel = *reinterpret_cast<const u16_le*>(bytes);
109 return { Convert4To8((pixel >> 12) & 0xF), Convert4To8((pixel >> 8) & 0xF), 109 return {Convert4To8((pixel >> 12) & 0xF), Convert4To8((pixel >> 8) & 0xF),
110 Convert4To8((pixel >> 4) & 0xF), Convert4To8(pixel & 0xF) }; 110 Convert4To8((pixel >> 4) & 0xF), Convert4To8(pixel & 0xF)};
111} 111}
112 112
113/** 113/**
@@ -134,7 +134,7 @@ inline u32 DecodeD24(const u8* bytes) {
134 * @return Resulting values stored as a Math::Vec2 134 * @return Resulting values stored as a Math::Vec2
135 */ 135 */
136inline const Math::Vec2<u32> DecodeD24S8(const u8* bytes) { 136inline const Math::Vec2<u32> DecodeD24S8(const u8* bytes) {
137 return { static_cast<u32>((bytes[2] << 16) | (bytes[1] << 8) | bytes[0]), bytes[3] }; 137 return {static_cast<u32>((bytes[2] << 16) | (bytes[1] << 8) | bytes[0]), bytes[3]};
138} 138}
139 139
140/** 140/**
@@ -175,8 +175,8 @@ inline void EncodeRG8(const Math::Vec4<u8>& color, u8* bytes) {
175 * @param bytes Destination pointer to store encoded color 175 * @param bytes Destination pointer to store encoded color
176 */ 176 */
177inline void EncodeRGB565(const Math::Vec4<u8>& color, u8* bytes) { 177inline void EncodeRGB565(const Math::Vec4<u8>& color, u8* bytes) {
178 *reinterpret_cast<u16_le*>(bytes) = (Convert8To5(color.r()) << 11) | 178 *reinterpret_cast<u16_le*>(bytes) =
179 (Convert8To6(color.g()) << 5) | Convert8To5(color.b()); 179 (Convert8To5(color.r()) << 11) | (Convert8To6(color.g()) << 5) | Convert8To5(color.b());
180} 180}
181 181
182/** 182/**
@@ -186,7 +186,8 @@ inline void EncodeRGB565(const Math::Vec4<u8>& color, u8* bytes) {
186 */ 186 */
187inline void EncodeRGB5A1(const Math::Vec4<u8>& color, u8* bytes) { 187inline void EncodeRGB5A1(const Math::Vec4<u8>& color, u8* bytes) {
188 *reinterpret_cast<u16_le*>(bytes) = (Convert8To5(color.r()) << 11) | 188 *reinterpret_cast<u16_le*>(bytes) = (Convert8To5(color.r()) << 11) |
189 (Convert8To5(color.g()) << 6) | (Convert8To5(color.b()) << 1) | Convert8To1(color.a()); 189 (Convert8To5(color.g()) << 6) |
190 (Convert8To5(color.b()) << 1) | Convert8To1(color.a());
190} 191}
191 192
192/** 193/**
@@ -196,7 +197,8 @@ inline void EncodeRGB5A1(const Math::Vec4<u8>& color, u8* bytes) {
196 */ 197 */
197inline void EncodeRGBA4(const Math::Vec4<u8>& color, u8* bytes) { 198inline void EncodeRGBA4(const Math::Vec4<u8>& color, u8* bytes) {
198 *reinterpret_cast<u16_le*>(bytes) = (Convert8To4(color.r()) << 12) | 199 *reinterpret_cast<u16_le*>(bytes) = (Convert8To4(color.r()) << 12) |
199 (Convert8To4(color.g()) << 8) | (Convert8To4(color.b()) << 4) | Convert8To4(color.a()); 200 (Convert8To4(color.g()) << 8) |
201 (Convert8To4(color.b()) << 4) | Convert8To4(color.a());
200} 202}
201 203
202/** 204/**