summaryrefslogtreecommitdiff
path: root/NxWidgets
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-22 23:49:15 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-22 23:49:15 +0000
commitb4d61b2271d14e5e73a54eddae16502d30e2825e (patch)
treee40c5e9ad9a10e28f4a28ff6fbbddaaeec8441a9 /NxWidgets
parent7f085e8bf5f5bdf0cc2b8e39123db7bfa9a0742a (diff)
downloadpx4-nuttx-b4d61b2271d14e5e73a54eddae16502d30e2825e.tar.gz
px4-nuttx-b4d61b2271d14e5e73a54eddae16502d30e2825e.tar.bz2
px4-nuttx-b4d61b2271d14e5e73a54eddae16502d30e2825e.zip
Hack for font background when we cannot read from the LCD; Candidate fix for ILI9325 LCD
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4763 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets')
-rw-r--r--NxWidgets/ChangeLog.txt8
-rw-r--r--NxWidgets/TODO.txt15
-rw-r--r--NxWidgets/libnxwidgets/include/cgraphicsport.hxx30
-rw-r--r--NxWidgets/libnxwidgets/src/cbuttonarray.cxx18
4 files changed, 70 insertions, 1 deletions
diff --git a/NxWidgets/ChangeLog.txt b/NxWidgets/ChangeLog.txt
index 349dbac57..f688f846c 100644
--- a/NxWidgets/ChangeLog.txt
+++ b/NxWidgets/ChangeLog.txt
@@ -144,3 +144,11 @@
example.
* NXWidgets::CNxTkWindow: Back out height adjustment in the getSize()
method. The code was correct as it was before.
+* NXWidgets::CButtonArray and NXWidgets::CGraphicsPort: There is
+ a kludge in there to handle the case where we cannot read the
+ background data because the LCD does not support read operations.
+ In that case, we just use the default background color. However,
+ that doesn't work either for the case where the background color
+ changes when the widget is selected. Thenthe background color
+ in the font is wrong. Fixed in CButtonArrary, but the problem
+ probably exists in other places as well.
diff --git a/NxWidgets/TODO.txt b/NxWidgets/TODO.txt
index edd203210..ebf136798 100644
--- a/NxWidgets/TODO.txt
+++ b/NxWidgets/TODO.txt
@@ -127,3 +127,18 @@ o Platform specific issues
The fixed version is available in SVN but won't be in a released
version until NuttX-6.198 is released.
Priorioty: Low, but really annoying.
+
+ Title: BUGS WHEN CANNOT READ FROM LCD
+ Description: There is a kludge in there to handle the case where we cannot
+ read the background data because the LCD does not support read
+ operations. You cannot read from the STM3240G-EVAL LCD right
+ now (it might be possible, but I have not figured out how yet).
+
+ In that case, we just use the default background color. However,
+ that doesn't work either for the case where the background color
+ changes when the widget is selected. Then the background color
+ in the font is wrong. There is a hack in in CButtonArrary that
+ fixed this problem, but the problem certainly exists in other
+ places as well and begs for a better solution.
+ Status: Open
+ Priority: Medium-Low
diff --git a/NxWidgets/libnxwidgets/include/cgraphicsport.hxx b/NxWidgets/libnxwidgets/include/cgraphicsport.hxx
index 8eea3d689..b9fbc4d41 100644
--- a/NxWidgets/libnxwidgets/include/cgraphicsport.hxx
+++ b/NxWidgets/libnxwidgets/include/cgraphicsport.hxx
@@ -152,6 +152,36 @@ namespace NXWidgets
const nxgl_coord_t getY(void) const;
/**
+ * Get the background color that will be used to fill in the spaces
+ * when rendering fonts. This background color is ONLY used if the
+ * LCD device does not support reading GRAM contents.
+ *
+ * @return. The current background color being used.
+ */
+
+#ifdef CONFIG_NX_WRITEONLY
+ nxgl_mxpixel_t getBackColor(void) const
+ {
+ return m_backColor;
+ }
+#endif
+
+ /**
+ * Set the background color that will be used to fill in the spaces
+ * when rendering fonts. This background color is ONLY used if the
+ * LCD device does not support reading GRAM contents.
+ *
+ * @return. The current background color being used.
+ */
+
+#ifdef CONFIG_NX_WRITEONLY
+ void setBackColor(nxgl_mxpixel_t backColor)
+ {
+ m_backColor = backColor;
+ }
+#endif
+
+ /**
* Draw a pixel into the window.
*
* @param x The window-relative x coordinate of the pixel.
diff --git a/NxWidgets/libnxwidgets/src/cbuttonarray.cxx b/NxWidgets/libnxwidgets/src/cbuttonarray.cxx
index 642a0a562..28f14062b 100644
--- a/NxWidgets/libnxwidgets/src/cbuttonarray.cxx
+++ b/NxWidgets/libnxwidgets/src/cbuttonarray.cxx
@@ -519,9 +519,25 @@ void CButtonArray::drawButton(CGraphicsPort *port, int column, int row, bool use
pos.x = x + alignX;
pos.y = y + alignY;
- // And draw the button text
+ // Set the CGraphicsControl background to match the selected background color.
+ // This is only necessary if we cannot read from the LCD. If we cannot read
+ // from then the font background is set to this background color.
+ // REVISIT: This begs for a more generalized solution.
+
+#ifdef CONFIG_NX_WRITEONLY
+ nxgl_mxpixel_t saveColor = port->getBackColor();
+ port->setBackColor(backColor);
+#endif
+
+ // And draw the button text.
port->drawText(&pos, &rect, getFont(), *text, 0, text->getLength(), textColor);
+
+ // Restore the default background color
+
+#ifdef CONFIG_NX_WRITEONLY
+ port->setBackColor(saveColor);
+#endif
}
/**