summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-07-12 07:44:56 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-07-12 07:44:56 -0600
commit1a9552fd99b76cd489eebc4dee82ceceee362515 (patch)
treec8087ef00c21bdebd0dd827f22fe47f802cb0b40
parentce33bb8776141460f0f07887d4710e9dc0c21c9b (diff)
downloadnuttx-1a9552fd99b76cd489eebc4dee82ceceee362515.tar.gz
nuttx-1a9552fd99b76cd489eebc4dee82ceceee362515.tar.bz2
nuttx-1a9552fd99b76cd489eebc4dee82ceceee362515.zip
NX graphics library: Macroize some color operators that become trivial when there is only one color plane
-rw-r--r--nuttx/drivers/rwbuffer.c10
-rw-r--r--nuttx/include/nuttx/nx/nxglib.h8
-rw-r--r--nuttx/libnx/nxglib/Make.defs20
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