[Pkg-wmaker-commits] [wmbubble] 54/207: use memcpy in draw_digit; gcc knows what to do with it (but doesn't with a normal copying loop?)

Doug Torrance dtorrance-guest at moszumanska.debian.org
Mon Aug 24 04:18:01 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmbubble.

commit fb6147a33df487e7670760d86338b40317421803
Author: Robert Jacobs <rnjacobs at mit.edu>
Date:   Tue Aug 2 21:27:19 2011 -0700

    use memcpy in draw_digit; gcc knows what to do with it (but doesn't with a normal copying loop?)
---
 bubblemon.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/bubblemon.c b/bubblemon.c
index 95de185..e33d73b 100644
--- a/bubblemon.c
+++ b/bubblemon.c
@@ -838,15 +838,14 @@ void draw_from_xpm(char **xpm, unsigned char *whither, unsigned int targetw,
 	}
 }
 
-/* draws 3x8 digits for the memory/swap panel */
+/* draws 3x8 (4x9 padding) digits for the memory/swap panel */
 void draw_digit(unsigned char * from, unsigned char * whither) {
-	int xx, yy;
-	unsigned char *to;
+	int yy;
 	/* assumes layout of from is 3x9x3bpp */
 	for (yy = 0; yy < 8; yy++) {
-		to = whither + BOX_SIZE*3*yy;
-		for (xx = 0; xx < 9; xx++)
-			*to++ = *from++;
+		memcpy(whither, from, 12);
+		from += 12;
+		whither += 3*BOX_SIZE;
 	}
 }
 
@@ -866,7 +865,7 @@ void draw_string(char *string, int x, int y, int color) {
 		else if (c >= '0' && c <= '9') c -= '0';
 
 		if (c <= 11)
-			draw_digit(&graph_numbers[3*3*9*c],
+			draw_digit(&graph_numbers[3*4*9*c],
 			           &bm.mem_buf[3*(y*BOX_SIZE+x)]);
 		x += 4;
 	}
@@ -1345,13 +1344,13 @@ void bubblemon_allocate_buffers(void) {
 
 	empty_loadgraph = calloc(BOX_SIZE * BOX_SIZE,3);
 	empty_memgraph = calloc(BOX_SIZE * BOX_SIZE,3);
-	graph_numbers_n_rgb = calloc(3*3*9*12,1);
-	graph_numbers_b_rgb = calloc(3*3*9*12,1);
+	graph_numbers_n_rgb = calloc(3*4*9*12,1);
+	graph_numbers_b_rgb = calloc(3*4*9*12,1);
 
 	for (ii = 0; ii < 12; ii++) {
-		draw_from_xpm(numbers_xpm,&graph_numbers_n_rgb[ii*3*3*9],3,
+		draw_from_xpm(numbers_xpm,&graph_numbers_n_rgb[ii*3*4*9],4,
 		              4*ii,0,3,9,graph_digit_colors[0]);
-		draw_from_xpm(numbers_xpm,&graph_numbers_b_rgb[ii*3*3*9],3,
+		draw_from_xpm(numbers_xpm,&graph_numbers_b_rgb[ii*3*4*9],4,
 		              4*ii,0,3,9,graph_digit_colors[1]);
 	}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbubble.git



More information about the Pkg-wmaker-commits mailing list