summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2013-12-18 14:54:30 +0100
committerTom Gundersen <teg@jklm.no>2013-12-18 20:16:47 +0100
commite550bd29a17a792f7956f3120e5c160967fe3bed (patch)
tree9da66a22872a1859fc366fea37a582ae38163fe3
parent2535b8c88e6fa6efeb7eef5d6d9ea464d360a237 (diff)
graphics: support smaller than 2^n colormaps
-rw-r--r--src/efi/graphics.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/efi/graphics.c b/src/efi/graphics.c
index 23b5d7d..69a77a4 100644
--- a/src/efi/graphics.c
+++ b/src/efi/graphics.c
@@ -179,16 +179,20 @@ EFI_STATUS bmp_to_blt(UINT8 *bmp, UINTN size,
UINT32 map_count;
UINTN map_size;
- switch (dib->depth) {
- case 1:
- case 4:
- case 8:
- map_count = 1 << dib->depth;
- break;
-
- default:
- map_count = 0;
- break;
+ if (dib->colors_used)
+ map_count = dib->colors_used;
+ else {
+ switch (dib->depth) {
+ case 1:
+ case 4:
+ case 8:
+ map_count = 1 << dib->depth;
+ break;
+
+ default:
+ map_count = 0;
+ break;
+ }
}
map_size = file->offset - (sizeof(struct bmp_file) + dib->size);