changeset 409:319cd8857399

replace inner loops with memcpy
author nadvornik
date Fri, 18 Apr 2008 21:30:12 +0000
parents fcba18ac1551
children 603206ffa644
files src/pixbuf-renderer.c
diffstat 1 files changed, 14 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/pixbuf-renderer.c	Fri Apr 18 20:41:09 2008 +0000
+++ b/src/pixbuf-renderer.c	Fri Apr 18 21:30:12 2008 +0000
@@ -2246,7 +2246,7 @@
 	guchar *s_pix, *d_pix;
 	guchar *sp, *dp;
 	guchar *ip, *spi, *dpi;
-	gint i, j, n;
+	gint i, j;
 	gint tw = pr->tile_width;
 		
 	srs = gdk_pixbuf_get_rowstride(src);
@@ -2265,8 +2265,8 @@
 		for (j = x; j < x + w; j++)
 			{
 			dp = ip + (j * drs);
-			for (n = 0; n < COLOR_BYTES; n++)
-				*(dp++) = *(sp++);
+			memcpy(dp, sp, COLOR_BYTES);
+			sp += COLOR_BYTES;
 			}
 		}
 	
@@ -2282,7 +2282,7 @@
 	guchar *s_pix, *d_pix;
 	guchar *sp, *dp;
 	guchar *ip, *spi, *dpi;
-	gint i, j, n;
+	gint i, j;
 	gint th = pr->tile_height;
 	
 	srs = gdk_pixbuf_get_rowstride(src);
@@ -2301,8 +2301,8 @@
 		for (j = x; j < x + w; j++)
 			{
 			dp = ip - (j * drs);
-			for (n = 0; n < COLOR_BYTES; n++)
-				*(dp++) = *(sp++);
+			memcpy(dp, sp, COLOR_BYTES);
+			sp += COLOR_BYTES;
 			}
 		}
 	
@@ -2318,7 +2318,7 @@
 	guchar *s_pix, *d_pix;
 	guchar *sp, *dp;
 	guchar *spi, *dpi;
-	gint i, j, n;
+	gint i, j;
 
 	gint tw = pr->tile_width;
 
@@ -2337,8 +2337,8 @@
 		dp = dpi + (i * drs);
 		for (j = 0; j < w; j++)
 			{
-			for (n = 0; n < COLOR_BYTES; n++)
-				dp[n] = *(sp++);
+			memcpy(dp, sp, COLOR_BYTES);
+			sp += COLOR_BYTES;
 			dp -= COLOR_BYTES;
 			}
 		}
@@ -2355,7 +2355,7 @@
 	guchar *s_pix, *d_pix;
 	guchar *sp, *dp;
 	guchar *spi, *dpi;
-	gint i, j, n;
+	gint i, j;
 	gint tw = pr->tile_width;
 	gint th = pr->tile_height;
 
@@ -2374,8 +2374,8 @@
 		dp = dpi - (i * drs) - (x * COLOR_BYTES);
 		for (j = 0; j < w; j++)
 			{
-			for (n = 0; n < COLOR_BYTES; n++)
-				dp[n] = *(sp++);
+			memcpy(dp, sp, COLOR_BYTES);
+			sp += COLOR_BYTES;
 			dp -= COLOR_BYTES;
 			}
 		}
@@ -2392,7 +2392,7 @@
 	guchar *s_pix, *d_pix;
 	guchar *sp, *dp;
 	guchar *spi, *dpi;
-	gint i, j, n;
+	gint i;
 	gint th = pr->tile_height;
 
 	srs = gdk_pixbuf_get_rowstride(src);
@@ -2408,11 +2408,7 @@
 		{
 		sp = spi + (i * srs);
 		dp = dpi - (i * drs);
-		for (j = 0; j < w; j++)
-			{
-			for (n = 0; n < COLOR_BYTES; n++)
-				*(dp++) = *(sp++);
-			}
+		memcpy(dp, sp, w * COLOR_BYTES);
 		}
 
 	pr->spare_tile = src;