mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
NX: Don't change the background if the color has not really changed
This commit is contained in:
+13
-3
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user