summaryrefslogtreecommitdiff
path: root/nuttx/graphics
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-07-11 20:47:12 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-07-11 20:47:12 -0600
commit09f13c0f6b617fb516a6679877831de235d40dd0 (patch)
tree43413c17dc5f6c30718606dc40b82fda7eda248e /nuttx/graphics
parentd031ee1a1c2661cfa5bd1027e361c6d94498154a (diff)
downloadnuttx-09f13c0f6b617fb516a6679877831de235d40dd0.tar.gz
nuttx-09f13c0f6b617fb516a6679877831de235d40dd0.tar.bz2
nuttx-09f13c0f6b617fb516a6679877831de235d40dd0.zip
NX: Don't change the background if the color has not really changed
Diffstat (limited to 'nuttx/graphics')
-rw-r--r--nuttx/graphics/Kconfig16
-rw-r--r--nuttx/graphics/nxbe/nxbe_configure.c17
-rw-r--r--nuttx/graphics/nxmu/nxmu_server.c15
-rw-r--r--nuttx/graphics/nxsu/nx_setbgcolor.c12
4 files changed, 52 insertions, 8 deletions
diff --git a/nuttx/graphics/Kconfig b/nuttx/graphics/Kconfig
index 6c58478d8..85e2164a8 100644
--- a/nuttx/graphics/Kconfig
+++ b/nuttx/graphics/Kconfig
@@ -25,9 +25,19 @@ config NX_NPLANES
int "Number of Color Planes"
default 1
---help---
- Some YUV color formats requires support for multiple planes, one for each
- color component. Unless you have such special hardware, this value should be
- undefined or set to 1.
+ Some YUV color formats requires support for multiple planes, one for
+ each color component. Unless you have such special hardware (and
+ are willing to debug a lot of untested logic), this value should be
+ set to 1.
+
+config NX_BGCOLOR
+ hex "Initial background color"
+ default 0x0
+ ---help---
+ NX will clear the background plane initially. This is the default
+ color that will be used when the background is cleared. Note: This
+ logic would have to be extended if you want to support multiple
+ color planes.
config NX_WRITEONLY
bool "Write-only Graphics Device"
diff --git a/nuttx/graphics/nxbe/nxbe_configure.c b/nuttx/graphics/nxbe/nxbe_configure.c
index 80c71db3a..0abfae659 100644
--- a/nuttx/graphics/nxbe/nxbe_configure.c
+++ b/nuttx/graphics/nxbe/nxbe_configure.c
@@ -49,6 +49,10 @@
* Pre-Processor Definitions
****************************************************************************/
+#ifndef CONFIG_NX_BGCOLOR
+# define CONFIG_NX_BGCOLOR 0
+#endif
+
/****************************************************************************
* Private Types
****************************************************************************/
@@ -57,6 +61,15 @@
* Private Data
****************************************************************************/
+static const nxgl_mxpixel_t g_bgcolor[CONFIG_NX_NPLANES] =
+{
+ CONFIG_NX_BGCOLOR
+
+#if CONFIG_NX_NPLANES > 1
+# warning Missing logic for multiple color planes
+#endif
+};
+
/****************************************************************************
* Public Data
****************************************************************************/
@@ -92,6 +105,10 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
return ret;
}
+ /* Set the initial background color */
+
+ nxgl_colorcopy(be->bgcolor, g_bgcolor);
+
/* Check the number of color planes */
#ifdef CONFIG_DEBUG
diff --git a/nuttx/graphics/nxmu/nxmu_server.c b/nuttx/graphics/nxmu/nxmu_server.c
index 44034c10e..4cb1246b5 100644
--- a/nuttx/graphics/nxmu/nxmu_server.c
+++ b/nuttx/graphics/nxmu/nxmu_server.c
@@ -486,9 +486,18 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
case NX_SVRMSG_SETBGCOLOR: /* Set the color of the background */
{
- FAR struct nxsvrmsg_setbgcolor_s *bgcolormsg = (FAR struct nxsvrmsg_setbgcolor_s *)buffer;
- nxgl_colorcopy(fe.be.bgcolor, bgcolormsg->color);
- nxbe_fill(&fe.be.bkgd, &fe.be.bkgd.bounds, bgcolormsg->color);
+ FAR struct nxsvrmsg_setbgcolor_s *bgcolormsg =
+ (FAR struct nxsvrmsg_setbgcolor_s *)buffer;
+
+ /* Has the background color changed? */
+
+ if (!nxgl_colorcmp(fe.be.bgcolor, bgcolormsg->color))
+ {
+ /* Yes.. fill the background */
+
+ nxgl_colorcopy(fe.be.bgcolor, bgcolormsg->color);
+ nxbe_fill(&fe.be.bkgd, &fe.be.bkgd.bounds, bgcolormsg->color);
+ }
}
break;
diff --git a/nuttx/graphics/nxsu/nx_setbgcolor.c b/nuttx/graphics/nxsu/nx_setbgcolor.c
index 5f9818855..8cf05edc9 100644
--- a/nuttx/graphics/nxsu/nx_setbgcolor.c
+++ b/nuttx/graphics/nxsu/nx_setbgcolor.c
@@ -97,7 +97,15 @@ int nx_setbgcolor(NXHANDLE handle,
}
#endif
- nxgl_colorcopy(fe->be.bgcolor, color);
- nxbe_fill(&fe->be.bkgd, &fe->be.bkgd.bounds, color);
+ /* Has the background color changed? */
+
+ if (!nxgl_colorcmp(fe.be.bgcolor, bgcolormsg->color))
+ {
+ /* Yes.. fill the background */
+
+ nxgl_colorcopy(fe->be.bgcolor, color);
+ nxbe_fill(&fe->be.bkgd, &fe->be.bkgd.bounds, color);
+ }
+
return OK;
}