changeset 2590:e7ed167c871d

Fix off-by-one-row bug in the block move functions when handling overlapping blocks
author bartv
date Sun, 09 Nov 2008 11:44:31 +0000
parents 9da21501bc5b
children b9088f7fbbd3
files packages/io/framebuf/current/ChangeLog packages/io/framebuf/current/src/linear.c
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/framebuf/current/ChangeLog
+++ b/packages/io/framebuf/current/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-09  Bart Veer  <bartv@ecoscentric.com>
+
+	* src/linear.c: fix the block move operations (new_y > y) overlap
+	handling.
+
 2008-10-06 Bart Veer  <bartv@ecoscentric.com>
 
 	* src/gen_framebufs.tcl, cdl/framebuf.cdl, tests/*: add some
--- a/packages/io/framebuf/current/src/linear.c
+++ b/packages/io/framebuf/current/src/linear.c
@@ -515,9 +515,9 @@ cyg_fb_linear_move_block_8_impl(void* fb
         dest   += (height * stride);
         
         for ( ; height; height--) {
-            __builtin_memcpy(dest, source, width);
             source  -= stride;
             dest    -= stride;
+            __builtin_memcpy(dest, source, width);
         }
         return;
     }
@@ -640,9 +640,9 @@ cyg_fb_linear_move_block_16_impl(void* f
         dest   = (cyg_uint16*)(((cyg_uint8*)dest)   + (height * stride8));
         width <<= 1;
         for ( ; height; height--) {
-            __builtin_memcpy(dest, source, width);
             source   = (cyg_uint16*)(((cyg_uint8*)source) - stride8);
             dest     = (cyg_uint16*)(((cyg_uint8*)dest) - stride8);
+            __builtin_memcpy(dest, source, width);
         }
         return;
     }
@@ -765,9 +765,9 @@ cyg_fb_linear_move_block_32_impl(void* f
         dest    = (cyg_uint32*)(((cyg_uint8*)dest)   + (height * stride8));
         width <<= 2;
         for ( ; height; height--) {
-            __builtin_memcpy(dest, source, width);
             source   = (cyg_uint32*)(((cyg_uint8*)source) - stride8);
             dest     = (cyg_uint32*)(((cyg_uint8*)dest) - stride8);
+            __builtin_memcpy(dest, source, width);
         }
         return;
     }