apps/graphics/pdcurs34: When clearing screen, width calculation should round up for any fractional bytes. When pdcurses is closed, forgot to close the djoystick driver.
This commit is contained in:
parent
a2ee61a124
commit
067c14ee05
@ -637,11 +637,11 @@ void PDC_clear_screen(FAR struct pdc_fbstate_s *fbstate)
|
||||
|
||||
/* Get the background color and display width */
|
||||
|
||||
bgcolor = PDCURSES_INIT_COLOR;
|
||||
width = fbstate->xres;
|
||||
bgcolor = PDCURSES_INIT_COLOR; /* Background color for one pixel */
|
||||
width = fbstate->xres; /* Width in units of pixels */
|
||||
|
||||
#if PDCURSES_BPP < 8
|
||||
/* Pack multiple pixels into one byte */
|
||||
/* Pack multiple pixels into one byte. Works for BPP={1,2,4} */
|
||||
|
||||
#if PDCURSES_BPP == 1 /* BPP = 1 */
|
||||
bgcolor &= 1; /* Isolate 0 */
|
||||
@ -656,9 +656,10 @@ void PDC_clear_screen(FAR struct pdc_fbstate_s *fbstate)
|
||||
bgcolor &= 15; /* Isolate 0-3 */
|
||||
bgcolor = bgcolor << 4 | bgcolor; /* Replicate 0-3 to 4-7 */
|
||||
#endif
|
||||
|
||||
/* Convert the width of the display to units of bytes. */
|
||||
|
||||
width /= PDCURSES_PPB;
|
||||
width = (width + PDCURSES_PPB - 1) / PDCURSES_PPB;
|
||||
#endif
|
||||
|
||||
/* Write the initial color into the entire framebuffer */
|
||||
|
@ -399,3 +399,21 @@ int PDC_input_open(FAR struct pdc_fbstate_s *fbstate)
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: PDC_input_close
|
||||
*
|
||||
* Description:
|
||||
* Close any input devices and release any resources committed by
|
||||
* PDC_input_open()
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PDCURSES_HAVE_INPUT
|
||||
void PDC_input_close(FAR struct pdc_fbstate_s *fbstate)
|
||||
{
|
||||
#ifdef CONFIG_PDCURSES_DJOYSTICK
|
||||
close(fbstate->djfd);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -313,6 +313,19 @@ void PDC_clear_screen(FAR struct pdc_fbstate_s *fbstate);
|
||||
int PDC_input_open(FAR struct pdc_fbstate_s *fbstate);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: PDC_input_close
|
||||
*
|
||||
* Description:
|
||||
* Close any input devices and release any resources committed by
|
||||
* PDC_input_open()
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PDCURSES_HAVE_INPUT
|
||||
void PDC_input_close(FAR struct pdc_fbstate_s *fbstate);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
@ -87,6 +87,9 @@ void PDC_scr_free(void)
|
||||
fbstate = &fbscreen->fbstate;
|
||||
|
||||
close(fbstate->fbfd);
|
||||
#ifdef CONFIG_PDCURSES_HAVE_INPUT
|
||||
PDC_input_close(fbstate);
|
||||
#endif
|
||||
free(fbscreen);
|
||||
SP = NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user