From 82fafb2d555bc4a282f04fa6fe42b0294b8c4341 Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Sat, 30 Jan 2010 07:16:16 +0000 Subject: mandelbrot: use correct colors on greyscale targets (FS#10935) Tested on Clipv1 (sim/target) and Ipod3g (sim) Each color would be calculated as 0 Note the iteration over the whole range of colors is quite weird, and I can not really sense what max_iter represents (except it's a number of different colors, right?) It should be backported to branch after tomers check if color range is correct (FS#10935 mentions much smaller range for color targets as well) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24377 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/fractals/mandelbrot_set.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'apps/plugins/fractals/mandelbrot_set.c') diff --git a/apps/plugins/fractals/mandelbrot_set.c b/apps/plugins/fractals/mandelbrot_set.c index fbd527438e..ad5a172f33 100644 --- a/apps/plugins/fractals/mandelbrot_set.c +++ b/apps/plugins/fractals/mandelbrot_set.c @@ -31,14 +31,16 @@ static unsigned char imgbuffer[LCD_HEIGHT]; static fb_data imgbuffer[LCD_HEIGHT]; #endif -#define NUM_COLORS ((unsigned)(1 << LCD_DEPTH)) - +#ifdef USEGSLIB +#define LCOLOR(iter) (iter << 5) +#else /* * Spread iter's colors over color range. * 345 (=15*26-45) is max_iter maximal value * This implementation ignores pixel format, thus it is not uniformly spread */ -#define LCOLOR(iter) ((iter * NUM_COLORS) / 345) +#define LCOLOR(iter) ((iter << LCD_DEPTH) / 345) +#endif #ifdef HAVE_LCD_COLOR #define COLOR(iter) (fb_data)LCOLOR(iter) -- cgit v1.2.3