lib/vga_gfx: Add API to render text on a bitmap buffer
This commit introduces a new library, `vga_gfx`, to handle text rendering on a VGA planar buffer. The new functionality supports displaying text with various screen orientations (Normal, Left Up, Bottom Up, and Right Up). The key features are: - A new public API, `render_text_to_bitmap_buffer()`, that takes a text string, screen orientation, and buffer as input. - Automatic text wrapping to fit the screen's effective width, considering the specified orientation. - The `vga_gfx.c` library is conditionally compiled for both `romstage` and `ramstage` based on `CONFIG_VGA` and `CONFIG_ROMSTAGE_VGA` respectively. - Text is rendered as a 1-bit-per-pixel bitmap and then cropped to its bounding box to optimize the output size. - The `bootsplash.h` header file is updated with the new API prototype and related constants. This implementation allows for flexible text display, which is crucial for showing user notifications on devices that may operate in a rotated display mode. BUG=b:406725440 TEST=Verify VGA text rotation on Google/Felino. Change-Id: I80fcf0a3f106a44f8e4ecdeec38f54ff09f86e6f Signed-off-by: Kapil Porwal <kapilporwal@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/89089 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
parent
ec2875e38f
commit
a3e2073591
3 changed files with 385 additions and 0 deletions
|
|
@ -169,4 +169,18 @@ bool platform_is_low_battery_shutdown_needed(void);
|
|||
static inline bool platform_is_low_battery_shutdown_needed(void) { return false; }
|
||||
#endif
|
||||
|
||||
/*
|
||||
* VGA Mode 12h (640x480 with 16 colors):
|
||||
* As per page 13 of https://www.phatcode.net/res/221/files/vbe20.pdf
|
||||
* "Standard VGA mode numbers are 7 bits wide and presently range from 00h to 13h."
|
||||
* More details: https://wiki.osdev.org/VGA_Hardware#List_of_register_settings
|
||||
*/
|
||||
#define VGA12_WIDTH 640
|
||||
#define VGA12_HEIGHT 480
|
||||
#define VGA12_BITMAP_BUFFER_SZ (VGA12_WIDTH * VGA12_HEIGHT / 8)
|
||||
|
||||
void render_text_to_bitmap_buffer(unsigned char *image_bitmap_buffer,
|
||||
enum lb_fb_orientation orientation, const char *text_to_render,
|
||||
int *image_width, int *image_height);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue