]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Compute correct offset when copying from shadow buffer to frame buffer
authorRay Strode <rstrode@redhat.com>
Tue, 27 May 2008 21:52:27 +0000 (17:52 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 28 May 2008 13:25:28 +0000 (09:25 -0400)
When I added commit c12164c1622a2209fe07555e682cc479c6854e7e
to copy an entire row at a time to the framebuffer, I miscalculated the
offset to copy from/to.  Their may be uninitialized data at the
beginning and end of the temporary row buffer, if only part of the row
is getting copied.  We need to make sure we jump passed that junk in
memory and copy just the part that got filled in.

src/libply/ply-frame-buffer.c

index d097adfb256984080b897971a187270ca6f48db8..1c4a2761229e708ccabf500ea8dd99f519c38194 100644 (file)
@@ -381,8 +381,8 @@ ply_frame_buffer_copy_to_device (ply_frame_buffer_t *buffer,
                   &device_pixel_value, buffer->bytes_per_pixel);
         }
 
-      offset = row * buffer->row_stride * buffer->bytes_per_pixel;
-      memcpy (buffer->map_address + offset, row_buffer,
+      offset = row * buffer->row_stride * buffer->bytes_per_pixel + x * buffer->bytes_per_pixel;
+      memcpy (buffer->map_address + offset, row_buffer + x * buffer->bytes_per_pixel,
               width * buffer->bytes_per_pixel);
     }
   free (row_buffer);