aboutsummaryrefslogtreecommitdiff
path: root/src/bmp.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2013-09-15 00:31:17 -0400
committerKevin O'Connor <kevin@koconnor.net>2013-09-18 20:48:35 -0400
commit07cf73bad4c622cb92bf509c1b77572cc54d17e9 (patch)
tree60e03250d665e699615b1070b3925cd73fa9b29e /src/bmp.c
parent392d2aacb6065319be3d31fdb37fef393e0149a9 (diff)
downloadseabios-hppa-07cf73bad4c622cb92bf509c1b77572cc54d17e9.zip
seabios-hppa-07cf73bad4c622cb92bf509c1b77572cc54d17e9.tar.gz
seabios-hppa-07cf73bad4c622cb92bf509c1b77572cc54d17e9.tar.bz2
Merge bmp.h, boot.h, jpeg.h, and post.h into util.h.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/bmp.c')
-rw-r--r--src/bmp.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/bmp.c b/src/bmp.c
index 68952f6..d8e76b7 100644
--- a/src/bmp.c
+++ b/src/bmp.c
@@ -6,9 +6,17 @@
*
* This work is licensed under the terms of the GNU LGPLv3.
*/
-#include "bmp.h" // struct bmp_decdata
#include "malloc.h" // malloc_tmphigh
#include "string.h" // memcpy
+#include "util.h" // struct bmp_decdata
+
+struct bmp_decdata {
+ struct tagRGBQUAD *quadp;
+ unsigned char *datap;
+ int width;
+ int height;
+ int bpp;
+};
#define bmp_load4byte(addr) (*(u32 *)(addr))
#define bmp_load2byte(addr) (*(u16 *)(addr))
@@ -59,12 +67,14 @@ static void raw_data_format_adjust_24bpp(u8 *src, u8 *dest, int width,
}
}
+/* allocate decdata struct */
struct bmp_decdata *bmp_alloc(void)
{
struct bmp_decdata *bmp = malloc_tmphigh(sizeof(*bmp));
return bmp;
}
+/* extract information from bmp file data */
int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size)
{
if (data_size < 54)
@@ -84,13 +94,14 @@ int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size)
return 0;
}
+/* get bmp properties */
void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height)
{
*width = bmp->width;
*height = bmp->height;
}
-
+/* flush flat picture data to *pc */
int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width
, int height, int depth, int bytes_per_line_dest)
{