From 75339f935d38ae42b1a16b050366fb4c0be544c0 Mon Sep 17 00:00:00 2001
From: patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>
Date: Sun, 10 Jul 2011 18:54:54 +0000
Subject: [PATCH] Fix an error in the NX move logic

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3766 42af7a65-404d-4744-a932-0658087f49c3
---
 ChangeLog                              |  4 +++-
 Documentation/NXGraphicsSubsystem.html |  4 ++--
 graphics/nxbe/nxbe_move.c              | 10 ++++++----
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a552284f1e..a933a05030 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1889,4 +1889,6 @@
 	  (also submitted by Hal Glenn).
 	* graphics/nxfonts/nxfonts_convert.c:  Fixed a critical bug that caused
 	  when renderer some fonts with bits-per-pixel > 8
-
+	* graphics/nxbe/nxbe_move.c: Fixed an error in the graphics move logic (This
+	  was a previously untested interface).  Basically, there is some confusion
+	  between use of (x,y) as a relative offset or as an absolute position.
diff --git a/Documentation/NXGraphicsSubsystem.html b/Documentation/NXGraphicsSubsystem.html
index d55d6e449c..e37c3b9cf2 100644
--- a/Documentation/NXGraphicsSubsystem.html
+++ b/Documentation/NXGraphicsSubsystem.html
@@ -12,7 +12,7 @@
       <h1><big><font color="#3c34ec">
         <i>NX Graphics Subsystem</i>
       </font></big></h1>
-      <p>Last Updated: March 20, 2010</p>
+      <p>Last Updated: July 10, 2011</p>
     </td>
   </tr>
 </table>
@@ -3014,7 +3014,7 @@ make
   <td align="left" valign="top"><a href="#nxmove"><code>nx_move()</code></a></td>
   <td>Change to <code>CONFIG_EXAMPLES_NX_RAWWINDOWS=y</code> in the
      <code>&lt;NuttX-Directory&gt;/.config</code> file</td>
-  <td align="center" bgcolor="lightgrey">NO</td>
+  <td align="center" bgcolor="skyblue">YES</td>
 </tr>
 <tr>
   <td align="left" valign="top"><a href="#nxbitmap"><code>nx_bitmap()</code></a></td>
diff --git a/graphics/nxbe/nxbe_move.c b/graphics/nxbe/nxbe_move.c
index d5bbe84038..b5c5cc6b77 100644
--- a/graphics/nxbe/nxbe_move.c
+++ b/graphics/nxbe/nxbe_move.c
@@ -89,12 +89,14 @@ static void nxbe_clipmovesrc(FAR struct nxbe_clipops_s *cops,
                              FAR const struct nxgl_rect_s *rect)
 {
   struct nxbe_move_s *info = (struct nxbe_move_s *)cops;
+  struct nxgl_point_s offset;
 
   if (info->offset.x != 0 || info->offset.y != 0)
     {
-      struct nxgl_rect_s dest;
-      nxgl_rectoffset(&dest, rect, info->offset.x, info->offset.y);
-      plane->moverectangle(&plane->pinfo, &dest, &info->offset);
+      offset.x = rect->pt1.x + info->offset.x;
+      offset.y = rect->pt1.y + info->offset.y;
+
+      plane->moverectangle(&plane->pinfo, rect, &offset);
     }
 }
 
@@ -156,7 +158,7 @@ static void nxbe_clipmovedest(FAR struct nxbe_clipops_s *cops,
         }
     }
 
-  /* Cip to determine what is inside the bounds */
+  /* Clip to determine what is inside the bounds */
 
   nxgl_rectoffset(&tmprect1, rect, -offset.x, -offset.y);
   nxgl_rectintersect(&src, &tmprect1, &dstdata->srcrect);
-- 
GitLab