mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-10-01 02:31:27 +02:00
video: Add a function to get the dimensions of a BMP image
This is useful for some other users, so break this out into a function. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
430e1676a7
commit
e90322f87c
@ -229,6 +229,16 @@ static void video_splash_align_axis(int *axis, unsigned long panel_size,
|
|||||||
*axis = max(0, (int)axis_alignment);
|
*axis = max(0, (int)axis_alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void video_bmp_get_info(void *bmp_image, ulong *widthp, ulong *heightp,
|
||||||
|
uint *bpixp)
|
||||||
|
{
|
||||||
|
struct bmp_image *bmp = bmp_image;
|
||||||
|
|
||||||
|
*widthp = get_unaligned_le32(&bmp->header.width);
|
||||||
|
*heightp = get_unaligned_le32(&bmp->header.height);
|
||||||
|
*bpixp = get_unaligned_le16(&bmp->header.bit_count);
|
||||||
|
}
|
||||||
|
|
||||||
int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
|
int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
|
||||||
bool align)
|
bool align)
|
||||||
{
|
{
|
||||||
@ -253,9 +263,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = get_unaligned_le32(&bmp->header.width);
|
video_bmp_get_info(bmp, &width, &height, &bmp_bpix);
|
||||||
height = get_unaligned_le32(&bmp->header.height);
|
|
||||||
bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);
|
|
||||||
hdr_size = get_unaligned_le16(&bmp->header.size);
|
hdr_size = get_unaligned_le16(&bmp->header.size);
|
||||||
debug("hdr_size=%d, bmp_bpix=%d\n", hdr_size, bmp_bpix);
|
debug("hdr_size=%d, bmp_bpix=%d\n", hdr_size, bmp_bpix);
|
||||||
palette = (void *)bmp + 14 + hdr_size;
|
palette = (void *)bmp + 14 + hdr_size;
|
||||||
@ -283,7 +291,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
|
|||||||
!(bmp_bpix == 24 && bpix == 16) &&
|
!(bmp_bpix == 24 && bpix == 16) &&
|
||||||
!(bmp_bpix == 24 && bpix == 32)) {
|
!(bmp_bpix == 24 && bpix == 32)) {
|
||||||
printf("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
|
printf("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
|
||||||
bpix, get_unaligned_le16(&bmp->header.bit_count));
|
bpix, colours);
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,6 +223,17 @@ int video_sync(struct udevice *vid, bool force);
|
|||||||
*/
|
*/
|
||||||
void video_sync_all(void);
|
void video_sync_all(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* video_bmp_get_info() - Get information about a bitmap image
|
||||||
|
*
|
||||||
|
* @bmp_image: Pointer to BMP image to check
|
||||||
|
* @widthp: Returns width in pixels
|
||||||
|
* @heightp: Returns height in pixels
|
||||||
|
* @bpixp: Returns log2 of bits per pixel
|
||||||
|
*/
|
||||||
|
void video_bmp_get_info(void *bmp_image, ulong *widthp, ulong *heightp,
|
||||||
|
uint *bpixp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* video_bmp_display() - Display a BMP file
|
* video_bmp_display() - Display a BMP file
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user