summaryrefslogtreecommitdiff
path: root/apps/plugins/fractals
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-01-30 07:16:16 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-01-30 07:16:16 +0000
commit82fafb2d555bc4a282f04fa6fe42b0294b8c4341 (patch)
treead362e047a028053387b3dc52ef5407c685cb75a /apps/plugins/fractals
parent436f4d3a204e8183d32d8c47975e6a294be1c0fa (diff)
downloadrockbox-82fafb2d555bc4a282f04fa6fe42b0294b8c4341.tar.gz
rockbox-82fafb2d555bc4a282f04fa6fe42b0294b8c4341.zip
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
Diffstat (limited to 'apps/plugins/fractals')
-rw-r--r--apps/plugins/fractals/mandelbrot_set.c8
1 files changed, 5 insertions, 3 deletions
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];
31static fb_data imgbuffer[LCD_HEIGHT]; 31static fb_data imgbuffer[LCD_HEIGHT];
32#endif 32#endif
33 33
34#define NUM_COLORS ((unsigned)(1 << LCD_DEPTH)) 34#ifdef USEGSLIB
35 35#define LCOLOR(iter) (iter << 5)
36#else
36/* 37/*
37 * Spread iter's colors over color range. 38 * Spread iter's colors over color range.
38 * 345 (=15*26-45) is max_iter maximal value 39 * 345 (=15*26-45) is max_iter maximal value
39 * This implementation ignores pixel format, thus it is not uniformly spread 40 * This implementation ignores pixel format, thus it is not uniformly spread
40 */ 41 */
41#define LCOLOR(iter) ((iter * NUM_COLORS) / 345) 42#define LCOLOR(iter) ((iter << LCD_DEPTH) / 345)
43#endif
42 44
43#ifdef HAVE_LCD_COLOR 45#ifdef HAVE_LCD_COLOR
44#define COLOR(iter) (fb_data)LCOLOR(iter) 46#define COLOR(iter) (fb_data)LCOLOR(iter)