apps/graphics/pdcurs34: Add some convenience definitions.

This commit is contained in:
Gregory Nutt 2017-11-27 06:49:38 -06:00
parent 7081f33ec3
commit efcbb38663
2 changed files with 12 additions and 6 deletions

View File

@ -239,7 +239,7 @@ static inline void PDC_set_bg(FAR struct pdc_fbstate_s *fbstate,
#if PDCURSES_BPP == 1
/* Get the start and end column in pixels (relative to the start position) */
startcol = col & 7;
startcol = col & PDCURSES_PPB_MASK;
endcol = startcol + fbstate->fwidth - 1;
/* Get the masks that we will need to perform the read-modify-write
@ -258,12 +258,12 @@ static inline void PDC_set_bg(FAR struct pdc_fbstate_s *fbstate,
* the final byte than may have fewer than 8 pixels in it).
*/
endcol = (endcol + 7) >> 3;
endcol = (endcol + PDCURSES_PPB_MASK) >> PDCURSES_PPB_SHIFT;
#elif PDCURSES_BPP == 2
/* Get the start and end colum in pixels (relative to the start position) */
startcol = col & 3;
startcol = col & PDCURSES_PPB_MASK;
endcol = startcol + fbstate->fwidth - 1;
/* Get the masks that we will need to perform the read-modify-write
@ -282,12 +282,12 @@ static inline void PDC_set_bg(FAR struct pdc_fbstate_s *fbstate,
* the final byte than may have fewer than 4 pixels in it).
*/
endcol = (endcol + 3) >> 2;
endcol = (endcol + PDCURSES_PPB_MASK) >> PDCURSES_PPB_SHIFT;
#elif PDCURSES_BPP == 4
/* Get the start and end colum in pixels (relative to the start position) */
startcol = col & 1;
startcol = col & PDCURSES_PPB_MASK;
endcol = startcol + fbstate->fwidth - 1;
/* Get the masks that we will need to perform the read-modify-write
@ -306,7 +306,7 @@ static inline void PDC_set_bg(FAR struct pdc_fbstate_s *fbstate,
* the final byte than may have only one pixel in it).
*/
endcol = (endcol + 1) >> 1;
endcol = (endcol + PDCURSES_PPB_MASK) >> PDCURSES_PPB_SHIFT;
#endif
/* Now copy the color into the entire glyph region */

View File

@ -113,18 +113,24 @@
# define PDCURSES_COLORFMT FB_FMT_Y1
# define PDCURSES_BPP 1
# define PDCURSES_PPB 8
# define PDCURSES_PPB_MASK (PDCURSES_PPB - 1)
# define PDCURSES_PPB_SHIFT 3
# define PDCURSES_INIT_COLOR CONFIG_PDCURSES_BGCOLOR_GREYLEVEL
# define PDCURSES_MONOCHROME 2
#elif defined(CONFIG_PDCURSES_COLORFMT_Y2)
# define PDCURSES_COLORFMT FB_FMT_Y2
# define PDCURSES_BPP 2
# define PDCURSES_PPB 4
# define PDCURSES_PPB_MASK (PDCURSES_PPB - 1)
# define PDCURSES_PPB_SHIFT 2
# define PDCURSES_INIT_COLOR CONFIG_PDCURSES_BGCOLOR_GREYLEVEL
# define PDCURSES_MONOCHROME 1
#elif defined(CONFIG_PDCURSES_COLORFMT_Y4)
# define PDCURSES_COLORFMT FB_FMT_Y4
# define PDCURSES_BPP 4
# define PDCURSES_PPB 2
# define PDCURSES_PPB_MASK (PDCURSES_PPB - 1)
# define PDCURSES_PPB_SHIFT 1
# define PDCURSES_INIT_COLOR CONFIG_PDCURSES_BGCOLOR_GREYLEVEL
# define PDCURSES_MONOCHROME 1
#elif defined(CONFIG_PDCURSES_COLORFMT_RGB332)