From 10b7eef7aa456adb7cf174cbeae10ab96da05b4c Mon Sep 17 00:00:00 2001 From: henyxia Date: Sat, 18 Apr 2015 19:21:51 +0200 Subject: [PATCH] Separated color allocation A pic take now about 17s to pop --- main.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 94d3516..641771b 100644 --- a/main.c +++ b/main.c @@ -178,6 +178,21 @@ int main(int argc, char* argv[]) if(XAllocColor(display, screen_colormap, &col) == 0) printf("Failed to allocate color\n"); + buffer[0] = getc(home); + buffer[1] = getc(home); + buffer[2] = getc(home); + printf("Alloc X %03d Y %03d R %02x G %02x B %02x\n", i%width, i/width, buffer[0], buffer[1], buffer[2]); + } + + + fseek(home, initOffsetBMP, SEEK_SET); + + for(i=0; i<76800; i++) + { + col.red = buffer[2] * 257; + col.green = buffer[1] * 257; + col.blue = buffer[0] * 257; + if(XSetForeground(display, gc, col.pixel) == 0) printf("Failed to set foreground\n"); if(XDrawPoint(display,win,gc,i%width,height-1-(i/width)) == 0) @@ -185,13 +200,11 @@ int main(int argc, char* argv[]) buffer[0] = getc(home); buffer[1] = getc(home); buffer[2] = getc(home); - //printf("X %03d Y %03d R %02x G %02x B %02x\n", i%width, i/width, buffer[0], buffer[1], buffer[2]); + printf("Disp X %03d Y %03d R %02x G %02x B %02x\n", i%width, i/width, buffer[0], buffer[1], buffer[2]); } - - /* draw two intersecting lines, one horizontal and one vertical, */ /* which intersect at point "50,100". */ /* draw the line in a brown color. */ -- libgit2 0.21.2