From: Ray Strode Date: Tue, 27 May 2008 21:52:27 +0000 (-0400) Subject: Compute correct offset when copying from shadow buffer to frame buffer X-Git-Tag: 0.1.0~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eddf693c9ba1efd5fcc4af7ec03a2c3386d4b649;p=thirdparty%2Fplymouth.git Compute correct offset when copying from shadow buffer to frame buffer 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. --- diff --git a/src/libply/ply-frame-buffer.c b/src/libply/ply-frame-buffer.c index d097adfb..1c4a2761 100644 --- a/src/libply/ply-frame-buffer.c +++ b/src/libply/ply-frame-buffer.c @@ -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);