From 3493c2919fb84c201303459afc6c6bcdf855185b Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 29 May 2008 14:34:35 -0400 Subject: [PATCH] Add an optimization for full width fills on some hardware If we know the rowstride is the same width as the frame buffer then we can memcpy multiple rows at one time. --- src/libply/ply-frame-buffer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libply/ply-frame-buffer.c b/src/libply/ply-frame-buffer.c index 288f7e76..dbf6f111 100644 --- a/src/libply/ply-frame-buffer.c +++ b/src/libply/ply-frame-buffer.c @@ -188,6 +188,12 @@ flush_xrgb32 (ply_frame_buffer_t *buffer) dst = &buffer->map_address[(y1 * buffer->row_stride + x1) * 4]; src = (char *) &buffer->shadow_buffer[y1 * buffer->row_stride + x1]; + if (buffer->area_to_flush.width == buffer->row_stride) + { + memcpy (dst, src, buffer->area_to_flush.width * buffer->area_to_flush.height * 4); + return; + } + for (y = y1; y < y2; y++) { memcpy (dst, src, buffer->area_to_flush.width * 4);