From 1a9552fd99b76cd489eebc4dee82ceceee362515 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 12 Jul 2014 07:44:56 -0600 Subject: NX graphics library: Macroize some color operators that become trivial when there is only one color plane --- nuttx/drivers/rwbuffer.c | 10 +++++++--- nuttx/include/nuttx/nx/nxglib.h | 8 ++++++++ nuttx/libnx/nxglib/Make.defs | 20 ++++++++++++-------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/nuttx/drivers/rwbuffer.c b/nuttx/drivers/rwbuffer.c index 6bb6c2762..7cd72246a 100644 --- a/nuttx/drivers/rwbuffer.c +++ b/nuttx/drivers/rwbuffer.c @@ -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; diff --git a/nuttx/include/nuttx/nx/nxglib.h b/nuttx/include/nuttx/nx/nxglib.h index 3b6037c4a..6e2d1a53d 100644 --- a/nuttx/include/nuttx/nx/nxglib.h +++ b/nuttx/include/nuttx/nx/nxglib.h @@ -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 diff --git a/nuttx/libnx/nxglib/Make.defs b/nuttx/libnx/nxglib/Make.defs index bc0ca0c93..8593c91ac 100644 --- a/nuttx/libnx/nxglib/Make.defs +++ b/nuttx/libnx/nxglib/Make.defs @@ -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 -- cgit v1.2.3