NX graphics library: Macroize some color operators that become trivial when there is only one color plane

This commit is contained in:
Gregory Nutt 2014-07-12 07:44:56 -06:00
parent 39c6f74966
commit 58ab6ec03f
3 changed files with 27 additions and 11 deletions

View File

@ -834,9 +834,13 @@ int rwb_read(FAR struct rwbuffer_s *rwb, off_t startblock, uint32_t nblocks,
}
else
#else
{
ret = rwb->rhreload(rwb->dev, startblock, nblocks, rdbuffer);
}
{
/* No read-ahead buffering, (re)load the data directly into
* the user buffer.
*/
ret = rwb->rhreload(rwb->dev, startblock, nblocks, rdbuffer);
}
#endif
return ret;

View File

@ -633,8 +633,12 @@ void nxgl_trapcopy(FAR struct nxgl_trapezoid_s *dest,
*
****************************************************************************/
#if CONFIG_NX_NPLANES == 1
# define nxgl_colorcopy(d,s) do { (d)[0] = s[0]; } while (0)
#else
void nxgl_colorcopy(nxgl_mxpixel_t dest[CONFIG_NX_NPLANES],
const nxgl_mxpixel_t src[CONFIG_NX_NPLANES]);
#endif
/****************************************************************************
* Name: nxgl_colorcmp
@ -646,8 +650,12 @@ void nxgl_colorcopy(nxgl_mxpixel_t dest[CONFIG_NX_NPLANES],
*
****************************************************************************/
#if CONFIG_NX_NPLANES == 1
# define nxgl_colorcmp(d,s) ((d)[0] == s[0])
#else
bool nxgl_colorcmp(const nxgl_mxpixel_t color1[CONFIG_NX_NPLANES],
const nxgl_mxpixel_t color2[CONFIG_NX_NPLANES]);
#endif
/****************************************************************************
* Name: nxgl_splitline

View File

@ -37,14 +37,18 @@
ifeq ($(CONFIG_NX),y)
CSRCS += nxglib_circlepts.c nxglib_circletraps.c nxglib_colorcmp.c
CSRCS += nxglib_colorcopy.c nxglib_intersecting.c nxglib_nonintersecting.c
CSRCS += nxglib_nullrect.c nxglib_rectadd.c nxglib_rectcopy.c
CSRCS += nxglib_rectinside.c nxglib_rectintersect.c nxglib_rectoffset.c
CSRCS += nxglib_rectoverlap.c nxglib_rectsize.c nxglib_rectunion.c
CSRCS += nxglib_rgb2yuv.c nxglib_runcopy.c nxglib_runoffset.c
CSRCS += nxglib_splitline.c nxglib_trapcopy.c nxglib_trapoffset.c
CSRCS += nxglib_vectoradd.c nxglib_vectsubtract.c nxglib_yuv2rgb.c
CSRCS += nxglib_circlepts.c nxglib_circletraps.c nxglib_intersecting.c
CSRCS += nxglib_nonintersecting.c nxglib_nullrect.c nxglib_rectadd.c
CSRCS += nxglib_rectcopy.c nxglib_rectinside.c nxglib_rectintersect.c
CSRCS += nxglib_rectoffset.c nxglib_rectoverlap.c nxglib_rectsize.c
CSRCS += nxglib_rectunion.c nxglib_rgb2yuv.c nxglib_runcopy.c
CSRCS += nxglib_runoffset.c nxglib_splitline.c nxglib_trapcopy.c
CSRCS += nxglib_trapoffset.c nxglib_vectoradd.c nxglib_vectsubtract.c
CSRCS += nxglib_yuv2rgb.c
ifneq ($(CONFIG_NX_NPLANES),1)
CSRCS += nxglib_colorcmp.c nxglib_colorcopy.c
endif
# Add the nxglib/ directory to the build