summaryrefslogtreecommitdiffstats
path: root/qemu/roms/seabios/src/bmp.c
diff options
context:
space:
mode:
authorRajithaY <rajithax.yerrumsetty@intel.com>2017-04-25 03:31:15 -0700
committerRajitha Yerrumchetty <rajithax.yerrumsetty@intel.com>2017-05-22 06:48:08 +0000
commitbb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch)
treeca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/roms/seabios/src/bmp.c
parenta14b48d18a9ed03ec191cf16b162206998a895ce (diff)
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to kvmfornfv repo and make use of the updated latest qemu for the execution of all testcase Change-Id: I1280af507a857675c7f81d30c95255635667bdd7 Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/roms/seabios/src/bmp.c')
-rw-r--r--qemu/roms/seabios/src/bmp.c117
1 files changed, 0 insertions, 117 deletions
diff --git a/qemu/roms/seabios/src/bmp.c b/qemu/roms/seabios/src/bmp.c
deleted file mode 100644
index 96a2b3f22..000000000
--- a/qemu/roms/seabios/src/bmp.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
-* Basic BMP data process and Raw picture data handle functions.
-* Could be used to adjust pixel data format, get information, etc.
-*
-* Copyright (C) 2011 Wayne Xia <xiawenc@cn.ibm.com>
-*
-* This work is licensed under the terms of the GNU LGPLv3.
-*/
-#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))
-
-typedef struct tagBITMAPFILEHEADER {
- u8 bfType[2];
- u8 bfSize[4];
- u8 bfReserved1[2];
- u8 bfReserved2[2];
- u8 bfOffBits[4];
-} BITMAPFILEHEADER, tagBITMAPFILEHEADER;
-
-typedef struct tagBITMAPINFOHEADER {
- u8 biSize[4];
- u8 biWidth[4];
- u8 biHeight[4];
- u8 biPlanes[2];
- u8 biBitCount[2];
- u8 biCompression[4];
- u8 biSizeImage[4];
- u8 biXPelsPerMeter[4];
- u8 biYPelsPerMeter[4];
- u8 biClrUsed[4];
- u8 biClrImportant[4];
-} BITMAPINFOHEADER, tagBITMAPINFOHEADER;
-
-typedef struct tagRGBQUAD {
- u8 rgbBlue;
- u8 rgbGreen;
- u8 rgbRed;
- u8 rgbReserved;
-} RGBQUAD, tagRGBQUAD;
-
-/* flat picture data adjusting function
-* description:
-* switch the vertical line sequence
-* arrange horizontal pixel data, add extra space in the dest buffer
-* for every line
-*/
-static void raw_data_format_adjust_24bpp(u8 *src, u8 *dest, int width,
- int height, int bytes_per_line_dest)
-{
- int bytes_per_line_src = 3 * width;
- int i;
- for (i = 0 ; i < height ; i++) {
- memcpy(dest + i * bytes_per_line_dest,
- src + (height - 1 - i) * bytes_per_line_src, bytes_per_line_src);
- }
-}
-
-/* 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)
- return 1;
-
- u16 bmp_filehead = bmp_load2byte(data + 0);
- if (bmp_filehead != 0x4d42)
- return 2;
- u32 bmp_recordsize = bmp_load4byte(data + 2);
- if (bmp_recordsize != data_size)
- return 3;
- u32 bmp_dataoffset = bmp_load4byte(data + 10);
- bmp->datap = (unsigned char *)data + bmp_dataoffset;
- bmp->width = bmp_load4byte(data + 18);
- bmp->height = bmp_load4byte(data + 22);
- bmp->bpp = bmp_load2byte(data + 28);
- 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)
-{
- if (bmp->datap == pic)
- return 0;
- /* now only support 24bpp bmp file */
- if ((depth == 24) && (bmp->bpp == 24)) {
- raw_data_format_adjust_24bpp(bmp->datap, pic, width, height,
- bytes_per_line_dest);
- return 0;
- }
- return 1;
-}