summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2013-12-17 12:59:31 +0100
committerTom Gundersen <teg@jklm.no>2013-12-17 14:59:28 +0100
commitcc7875327412bc0fdebbaa82a3c3c7ff96c58630 (patch)
tree62b92095c0f6265db06d5ee7fd01eddd12de9d21
parent0eaf881a42ecc244eeeb8e62d7814be07301e630 (diff)
graphics: add support for XRGB{16,32}
We now support all the formats GIMP can produce except for RGB16, though any alpha-channels are silently ignored.
-rw-r--r--src/efi/graphics.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/efi/graphics.c b/src/efi/graphics.c
index ec83fa8..9cb6cb4 100644
--- a/src/efi/graphics.c
+++ b/src/efi/graphics.c
@@ -140,8 +140,6 @@ EFI_STATUS bmp_to_blt(UINT8 *bmp, UINTN size,
/* check device-independent bitmap */
dib = (struct bmp_dib *)(bmp + sizeof(struct bmp_file));
- if (dib->compression != 0)
- return EFI_UNSUPPORTED;
if (dib->size < sizeof(struct bmp_dib))
return EFI_UNSUPPORTED;
@@ -150,7 +148,18 @@ EFI_STATUS bmp_to_blt(UINT8 *bmp, UINTN size,
case 4:
case 8:
case 24:
+ if (dib->compression != 0)
+ return EFI_UNSUPPORTED;
+
+ break;
+
+ case 16:
+ case 32:
+ if (dib->compression != 0 && dib->compression != 3)
+ return EFI_UNSUPPORTED;
+
break;
+
default:
return EFI_UNSUPPORTED;
}
@@ -242,12 +251,27 @@ EFI_STATUS bmp_to_blt(UINT8 *bmp, UINTN size,
out->Blue = map[*in].blue;
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;
+ in += 1;
+ break;
+ }
+
case 24:
out->Red = in[2];
out->Green = in[1];
out->Blue = in[0];
in += 2;
break;
+
+ case 32:
+ out->Red = in[3];
+ out->Green = in[2];
+ out->Blue = in[1];
+ in += 3;
+ break;
}
}