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 */
|
/* Get the background color and display width */
|
||||||
|
|
||||||
bgcolor = PDCURSES_INIT_COLOR;
|
bgcolor = PDCURSES_INIT_COLOR; /* Background color for one pixel */
|
||||||
width = fbstate->xres;
|
width = fbstate->xres; /* Width in units of pixels */
|
||||||
|
|
||||||
#if PDCURSES_BPP < 8
|
#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 */
|
#if PDCURSES_BPP == 1 /* BPP = 1 */
|
||||||
bgcolor &= 1; /* Isolate 0 */
|
bgcolor &= 1; /* Isolate 0 */
|
||||||
@ -656,9 +656,10 @@ void PDC_clear_screen(FAR struct pdc_fbstate_s *fbstate)
|
|||||||
bgcolor &= 15; /* Isolate 0-3 */
|
bgcolor &= 15; /* Isolate 0-3 */
|
||||||
bgcolor = bgcolor << 4 | bgcolor; /* Replicate 0-3 to 4-7 */
|
bgcolor = bgcolor << 4 | bgcolor; /* Replicate 0-3 to 4-7 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convert the width of the display to units of bytes. */
|
/* Convert the width of the display to units of bytes. */
|
||||||
|
|
||||||
width /= PDCURSES_PPB;
|
width = (width + PDCURSES_PPB - 1) / PDCURSES_PPB;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Write the initial color into the entire framebuffer */
|
/* Write the initial color into the entire framebuffer */
|
||||||
|
@ -399,3 +399,21 @@ int PDC_input_open(FAR struct pdc_fbstate_s *fbstate)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#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);
|
int PDC_input_open(FAR struct pdc_fbstate_s *fbstate);
|
||||||
#endif
|
#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
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,9 @@ void PDC_scr_free(void)
|
|||||||
fbstate = &fbscreen->fbstate;
|
fbstate = &fbscreen->fbstate;
|
||||||
|
|
||||||
close(fbstate->fbfd);
|
close(fbstate->fbfd);
|
||||||
|
#ifdef CONFIG_PDCURSES_HAVE_INPUT
|
||||||
|
PDC_input_close(fbstate);
|
||||||
|
#endif
|
||||||
free(fbscreen);
|
free(fbscreen);
|
||||||
SP = NULL;
|
SP = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user