apps/graphics/pdcurs34: Clear the framebuffer when it is initialized.
This commit is contained in:
parent
b3db0c32ec
commit
6eae5e0c4c
@ -103,12 +103,17 @@ config PDCURSES_FONT_10X20
|
||||
|
||||
endchoice # TUI Font Selection
|
||||
|
||||
config PDCURSES_MONO
|
||||
bool
|
||||
default n
|
||||
|
||||
choice
|
||||
prompt "Color Format Selection"
|
||||
default PDCURSES_COLORFMT_RGB565
|
||||
|
||||
config PDCURSES_COLORFMT_Y1
|
||||
bool "BPP=1 Monochrome"
|
||||
select PDCURSES_MONO
|
||||
depends on EXPERIMENTAL
|
||||
|
||||
config PDCURSES_COLORFMT_RGB332
|
||||
@ -121,3 +126,27 @@ config PDCURSES_COLORFMT_RGB888
|
||||
bool "BPP=32 RGB888"
|
||||
|
||||
endchoice # Color Format Selection
|
||||
|
||||
menu "Initial Screen Color"
|
||||
|
||||
config PDCURSES_BGCOLOR_GREYLEVEL
|
||||
int "Grey Level"
|
||||
default 0
|
||||
depends on PDCURSES_MONO
|
||||
|
||||
config PDCURSES_BGCOLOR_RED
|
||||
int "Red Component"
|
||||
default 0
|
||||
depends on !PDCURSES_MONO
|
||||
|
||||
config PDCURSES_BGCOLOR_GREEN
|
||||
int "Green Component"
|
||||
default 0
|
||||
depends on !PDCURSES_MONO
|
||||
|
||||
config PDCURSES_BGCOLOR_BLUE
|
||||
int "Blue Component"
|
||||
default 0
|
||||
depends on !PDCURSES_MONO
|
||||
|
||||
endmenu # Initial Screen Color
|
||||
|
@ -339,7 +339,7 @@ static void PDC_putc(FAR struct pdc_fbstate_s *fbstate, int row, int col,
|
||||
fbm = nxf_getbitmap(bold ? fbstate->hfont : fbstate->hbold,
|
||||
ch & A_CHARTEXT);
|
||||
#else
|
||||
fbm = nxf_getbitmap(fbstate->hfont, ch);
|
||||
fbm = nxf_getbitmap(fbstate->hfont, ch & A_CHARTEXT);
|
||||
#endif
|
||||
|
||||
if (fbm != NULL)
|
||||
|
@ -110,21 +110,31 @@
|
||||
# warning CONFIG_PDCURSES_COLORFMT_Y1 not yet supported
|
||||
# define PDCURSES_COLORFMT FB_FMT_Y1
|
||||
# define PDCURSES_BPP 1
|
||||
# define PDCURSES_INIT_COLOR PDCURSES_BGCOLOR_GREYLEVEL
|
||||
#elif defined(CONFIG_PDCURSES_COLORFMT_RGB332)
|
||||
# define PDCURSES_COLORFMT FB_FMT_RGB8_332
|
||||
# define PDCURSES_BPP 8
|
||||
# define PDCURSES_BPP_MASK 7
|
||||
# define PDCURSES_BPP_SHIFT 3
|
||||
# define PDCURSES_INIT_COLOR RGBTO8(CONFIG_PDCURSES_BGCOLOR_RED, \
|
||||
CONFIG_PDCURSES_BGCOLOR_GREEN, \
|
||||
CONFIG_PDCURSES_BGCOLOR_BLUE)
|
||||
#elif defined(CONFIG_PDCURSES_COLORFMT_RGB565)
|
||||
# define PDCURSES_COLORFMT FB_FMT_RGB16_565
|
||||
# define PDCURSES_BPP 16
|
||||
# define PDCURSES_BPP_MASK 15
|
||||
# define PDCURSES_BPP_SHIFT 4
|
||||
# define PDCURSES_INIT_COLOR RGBTO16(CONFIG_PDCURSES_BGCOLOR_RED, \
|
||||
CONFIG_PDCURSES_BGCOLOR_GREEN, \
|
||||
CONFIG_PDCURSES_BGCOLOR_BLUE)
|
||||
#elif defined(CONFIG_PDCURSES_COLORFMT_RGB888)
|
||||
# define PDCURSES_COLORFMT FB_FMT_RGB24 /* RGB24 at 32-BPP */
|
||||
# define PDCURSES_BPP 32
|
||||
# define PDCURSES_BPP_MASK 31
|
||||
# define PDCURSES_BPP_SHIFT 5
|
||||
# define PDCURSES_INIT_COLOR RGBTO24(CONFIG_PDCURSES_BGCOLOR_RED, \
|
||||
CONFIG_PDCURSES_BGCOLOR_GREEN, \
|
||||
CONFIG_PDCURSES_BGCOLOR_BLUE)
|
||||
#else
|
||||
# error No color format selected
|
||||
#endif
|
||||
|
@ -48,6 +48,63 @@
|
||||
|
||||
#include "pdcnuttx.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: PDC_clear_screen
|
||||
*
|
||||
* Description:
|
||||
* Set the framebuffer content to a single color
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void PDC_clear_screen(FAR struct pdc_fbstate_s *fbstate)
|
||||
{
|
||||
FAR uint8_t *line;
|
||||
FAR pdc_color_t *dest;
|
||||
int row;
|
||||
int col;
|
||||
|
||||
#ifdef CONFIG_LCD_UPDATE
|
||||
struct nxgl_rect_s rect;
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
/* Write the intial color into the entire framebuffer */
|
||||
|
||||
for (row = 0, line = (FAR uint8_t *)fbstate->fbmem;
|
||||
row < fbstate->yres;
|
||||
row++, line += fbstate->stride)
|
||||
{
|
||||
for (col = 0, dest = (FAR pdc_color_t *)line;
|
||||
col < fbstate->xres;
|
||||
col++)
|
||||
{
|
||||
*dest++ = PDCURSES_INIT_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LCD_UPDATE
|
||||
/* Update the entire display */
|
||||
/* Setup the bounding rectangle */
|
||||
|
||||
rect.pt1.x = 0;
|
||||
rect.pt1.y = 0;
|
||||
rect.pt2.x = fbstate->xres - 1;
|
||||
rect.pt2.y = fbstate->yres - 1;
|
||||
|
||||
/* Then perfom the update via IOCTL */
|
||||
|
||||
ret = ioctl(fbstate->fd, FBIO_UPDATE, (unsigned long)((uintptr_t)rect));
|
||||
if (ret < 0)
|
||||
{
|
||||
PDC_LOG(("ERROR: ioctl(FBIO_UPDATE) failed: %d\n", errno));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -286,6 +343,9 @@ int PDC_scr_open(int argc, char **argv)
|
||||
fbstate->hoffset = (fbstate->xres - fbstate->fwidth * SP->cols) / 2;
|
||||
fbstate->voffset = (fbstate->yres - fbstate->fheight * SP->lines) / 2;
|
||||
|
||||
/* Set the framebuffer to a known state */
|
||||
|
||||
PDC_clear_screen(fbstate);
|
||||
return OK;
|
||||
|
||||
errout_with_boldfont:
|
||||
|
Loading…
Reference in New Issue
Block a user