Fix rectangle logic

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2831 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2010-08-08 13:33:10 +00:00
parent 70db6f4c76
commit 37b25cfaaa
5 changed files with 51 additions and 27 deletions
+4
View File
@@ -1185,3 +1185,7 @@
* examples/nsh/nsh_telnetd.c - Fix compilation errors that happen * examples/nsh/nsh_telnetd.c - Fix compilation errors that happen
when both DHCPC and TELNETD are enabled in the Nuttshell. when both DHCPC and TELNETD are enabled in the Nuttshell.
* graphics/nxglib/fb/nxglib_moverectangle.c - Fix a logic error
that caused an uninitialized variable warning. I still don't
have a test to prove that the changes are correct.
+4 -2
View File
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: August 5, 2010</p> <p>Last Updated: August 7, 2010</p>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1858,7 +1858,9 @@ nuttx-5.9 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* examples/nsh/nsh_telnetd.c - Fix compilation errors that happen * examples/nsh/nsh_telnetd.c - Fix compilation errors that happen
when both DHCPC and TELNETD are enabled in the Nuttshell. when both DHCPC and TELNETD are enabled in the Nuttshell.
* graphics/nxglib/fb/nxglib_moverectangle.c - Fix a logic error
that caused an uninitialized variable warning. I still don't
have a test to prove that the changes are correct.
pascal-2.1 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt; pascal-2.1 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+3 -3
View File
@@ -25,8 +25,8 @@
<li><a href="http://sourceforge.net/projects/nuttx/files/" target="_top">Downloads</a></li> <li><a href="http://sourceforge.net/projects/nuttx/files/" target="_top">Downloads</a></li>
<li><a href="http://sourceforge.net/projects/nuttx/files/buildroot" target="_top">Toolchains</a></li> <li><a href="http://sourceforge.net/projects/nuttx/files/buildroot" target="_top">Toolchains</a></li>
<li><a href="http://nuttx.cvs.sourceforge.net/nuttx/" target="_top">Browse CVS</a></li> <li><a href="http://nuttx.cvs.sourceforge.net/nuttx/" target="_top">Browse CVS</a></li>
<li><a href="freeports.html" target="header">Free Ports</a></li>
<li><a href="http://dir.gmane.org/gmane.comp.embedded.nuttx" target="_top">gmane</a></li> <li><a href="http://dir.gmane.org/gmane.comp.embedded.nuttx" target="_top">gmane</a></li>
<li><a href="freeports.html" target="header">Free Ports</a></li>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -58,9 +58,9 @@
</tr> </tr>
<td>&nbsp</td> <td>&nbsp</td>
<td align="left" valign="top"> <td align="left" valign="top">
<a href="http://rss.groups.yahoo.com/group/nuttx/rss"><img src="rss.gif" border="0"></a></td> <a href="http://rss.groups.yahoo.com/group/nuttx/rss" target="_top"><img src="rss.gif" border="0"></a></td>
<tr> <tr>
</tr> </tr>
</table> </table>
</body> </body>
</html> </html>
+1 -10
View File
@@ -12,7 +12,7 @@ NuttX TODO List (Last updated August 7, 2010)
(1) USB (drivers/usbdev) (1) USB (drivers/usbdev)
(5) Libraries (lib/) (5) Libraries (lib/)
(12) File system/Generic drivers (fs/, drivers/) (12) File system/Generic drivers (fs/, drivers/)
(3) Graphics subystem (graphics/) (2) Graphics subystem (graphics/)
(1) Pascal add-on (pcode/) (1) Pascal add-on (pcode/)
(1) Documentation (Documentation/) (1) Documentation (Documentation/)
(6) Build system / Toolchains (6) Build system / Toolchains
@@ -465,15 +465,6 @@ o Graphics subystem (graphics/)
Status: Open Status: Open
Priority: Low (unless you need the p13201 then it is certainly higher). Priority: Low (unless you need the p13201 then it is certainly higher).
Description: When building for a framebuffer driver, there are warnings that a
symbol is used before being initialized in graphics/nxglib/ in all
of the auto-generated files named nxglib_moverectangle_*bpp.c. This
looks like a real error and must be fixed. I don't think that the
moverectangle logic is currently being used in any of the examples,
so this should not be a big problem.
Status: Open
Priority: Medium-to-High
o Pascal Add-On (pcode/) o Pascal Add-On (pcode/)
^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
+39 -12
View File
@@ -174,44 +174,71 @@ void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX)
# endif # endif
#endif #endif
/* Case 1: The destination position (offset) is above the displayed /* sline = address of the first pixel in the top row of the source in
* position (rect) * framebuffer memory
*/ */
if (offset->y < rect->pt1.y) sline = pinfo->fbmem + rect->pt1.y * stride + NXGL_SCALEX(rect->pt1.x);
{
/* Copy the rectangle from top down. */
sline = pinfo->fbmem + rect->pt1.y * stride + NXGL_SCALEX(rect->pt1.x); /* dline = address of the first pixel in the top row of the destination
dline = (FAR uint8_t*)sline - offset->y * stride - NXGL_SCALEX(offset->x); * in framebuffer memory. We get dline by subtract the offset from the
* source position.
*/
dline = (FAR uint8_t*)sline - offset->y * stride - NXGL_SCALEX(offset->x);
/* Case 1: Is the destination position above the displayed position?
* If the Y offset is negative, then the destination is offset to a
* postion below (or to the right) in the source in framebuffer memory.
*/
if (offset->y < 0)
{
/* Yes.. Copy the rectangle from top down (i.e., adding the stride
* to move to the next, lower row) */
while (rows--) while (rows--)
{ {
/* Copy the row */
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
nxgl_lowresmemcpy(dline, sline, width, leadmask, tailmask); nxgl_lowresmemcpy(dline, sline, width, leadmask, tailmask);
#else #else
NXGL_MEMCPY(dline, sline, width); NXGL_MEMCPY(dline, sline, width);
#endif #endif
/* Point to the next source/dest row below the current one */
dline += stride; dline += stride;
sline += stride; sline += stride;
} }
} }
/* Case 2: The destination position (offset) is below the displayed /* Case 2: No.. the destination position is above (or to the left of)
* position (rect) * the displayed source position
*/ */
else else
{ {
/* Copy the rectangle from the bottom up */ /* Adjust sline and dline to point to the bottom row (+1) of the
* source and destination rectangles in framebuffer memory.
*/
sline = pinfo->fbmem + rect->pt2.y * stride + NXGL_SCALEX(rect->pt1.x); unsigned int hoffset = rows * stride;
dline = (FAR uint8_t*)sline - offset->y * stride - NXGL_SCALEX(offset->x); sline += hoffset;
dline += hoffset;
/* Copy the rectangle from the bottom up (i.e., subtracting stride
* to re-position to the previous, higher row) */
while (rows--) while (rows--)
{ {
/* Point to the next source/dest row above the current one */
dline -= stride; dline -= stride;
sline -= stride; sline -= stride;
/* Copy the row */
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
nxgl_lowresmemcpy(dline, sline, width, leadmask, tailmask); nxgl_lowresmemcpy(dline, sline, width, leadmask, tailmask);
#else #else