From silovic@mare.zesoi.fer.hr Mon Apr 21 08:26:41 1997 Date: Mon, 21 Apr 1997 14:11:16 +0200 (MET DST) From: Miroslav Silovic To: gimp-developer@scam.xcf.berkeley.edu Subject: [gimp-devel][patch] 8bit visual on Solaris This caused gimp to be completely useless on Solaris with 8-bit visual. The off-by-one bug overwrote background_pixel, then store_color used the overwritten value in attempt to set that pixel. Also, with i looping like in this patch, background and foreground squares look correctly on startup. Wooo! :) --- buggy-color_transfer.c Mon Apr 21 14:06:48 1997 +++ new-color_transfer.c Mon Apr 21 14:06:17 1997 @@ -24,14 +24,14 @@ #define SQR(x) ((x) * (x)) /* for lightening */ -double highlights_add[255]; -double midtones_add[255]; -double shadows_add[255]; +double highlights_add[256]; +double midtones_add[256]; +double shadows_add[256]; /* for darkening */ -double highlights_sub[255]; -double midtones_sub[255]; -double shadows_sub[255]; +double highlights_sub[256]; +double midtones_sub[256]; +double shadows_sub[256]; /* color transfer functions */ void @@ -39,7 +39,7 @@ { int i; - for (i = 0; i < 255; i++) + for (i = 0; i < 256; i++) { highlights_add[i] = shadows_sub[255 - i] = (1.075 - 1 / ((double) i / 16.0 + 1)); midtones_add[i] = midtones_sub[i] = 0.667 * (1 - SQR (((double) i - 127.0) / 127.0));