summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2013-12-17 16:09:54 +0100
committerTom Gundersen <teg@jklm.no>2013-12-17 16:09:54 +0100
commit2535b8c88e6fa6efeb7eef5d6d9ea464d360a237 (patch)
tree2c6194b8c37add9778389cb56c55ea672bef0bd4
parentcc7875327412bc0fdebbaa82a3c3c7ff96c58630 (diff)
graphics: simplify 16bpp calculation
-rw-r--r--src/efi/graphics.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/efi/graphics.c b/src/efi/graphics.c
index 9cb6cb4..23b5d7d 100644
--- a/src/efi/graphics.c
+++ b/src/efi/graphics.c
@@ -252,9 +252,11 @@ EFI_STATUS bmp_to_blt(UINT8 *bmp, UINTN size,
break;
case 16: {
- out->Red = ((in[1] >> 2) & 0x1f) << 3;
- out->Green = (((in[1] << 3) & 0x1f) + (in[0] >> 5)) << 3;
- out->Blue = ((in[0] & 0x1f)) << 3;
+ UINT16 i = *(UINT16 *) in;
+
+ out->Red = (i & 0x7c00) >> 7;
+ out->Green = (i & 0x3e0) >> 2;
+ out->Blue = (i & 0x1f) << 3;
in += 1;
break;
}