summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2010-01-17 21:21:52 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2010-01-17 21:21:52 +0000
commitd8123629058c534835058f2db94ba1c2636408e2 (patch)
treefebd036719daf77ea719c0c39f4e14b0fe90f5e2 /apps/plugins
parentab450a81ec1d81d3ea92a5b14edd2265fc2227ea (diff)
downloadrockbox-d8123629058c534835058f2db94ba1c2636408e2.tar.gz
rockbox-d8123629058c534835058f2db94ba1c2636408e2.zip
Fractals: Use more colors
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24265 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/fractals/mandelbrot_set.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/apps/plugins/fractals/mandelbrot_set.c b/apps/plugins/fractals/mandelbrot_set.c
index ab20512b15..338875b8e4 100644
--- a/apps/plugins/fractals/mandelbrot_set.c
+++ b/apps/plugins/fractals/mandelbrot_set.c
@@ -30,25 +30,23 @@ static unsigned char imgbuffer[LCD_HEIGHT];
30static fb_data imgbuffer[LCD_HEIGHT]; 30static fb_data imgbuffer[LCD_HEIGHT];
31#endif 31#endif
32 32
33#define NUM_COLORS 8 /* Must be a power of 2 */ 33#define NUM_COLORS ((unsigned)(1 << LCD_DEPTH))
34/* NUM_COLORS entries cyclical, last entry is black (convergence) */ 34
35/*
36 * Spread iter's colors over color range.
37 * 345 (=15*26-45) is max_iter maximal value
38 * This implementation ignores pixel format, thus it is not uniformly spread
39 */
40#define LCOLOR(iter) ((iter * NUM_COLORS) / 345)
41
35#ifdef HAVE_LCD_COLOR 42#ifdef HAVE_LCD_COLOR
36static const fb_data color[NUM_COLORS] = { 43#define COLOR(iter) (fb_data)LCOLOR(iter)
37 LCD_RGBPACK(255, 0, 159), LCD_RGBPACK(159, 0, 255),
38 LCD_RGBPACK(0, 0, 255), LCD_RGBPACK(0, 159, 255),
39 LCD_RGBPACK(0, 255, 128), LCD_RGBPACK(128, 255, 0),
40 LCD_RGBPACK(255, 191, 0), LCD_RGBPACK(255, 0, 0)
41};
42#define CONVERGENCE_COLOR LCD_RGBPACK(0, 0, 0) 44#define CONVERGENCE_COLOR LCD_RGBPACK(0, 0, 0)
43#else /* greyscale */ 45#else /* greyscale */
44static const unsigned char color[NUM_COLORS] = { 46#define COLOR(iter) (unsigned char)LCOLOR(iter)
45 255, 223, 191, 159, 128, 96, 64, 32
46};
47#define CONVERGENCE_COLOR 0 47#define CONVERGENCE_COLOR 0
48#endif 48#endif
49 49
50#define COLOR(iter) color[(iter) % (NUM_COLORS - 1)]
51
52#if CONFIG_LCD == LCD_SSD1815 50#if CONFIG_LCD == LCD_SSD1815
53/* Recorder, Ondio: pixel_height == 1.25 * pixel_width */ 51/* Recorder, Ondio: pixel_height == 1.25 * pixel_width */
54#define MB_HEIGHT (LCD_HEIGHT*5/4) 52#define MB_HEIGHT (LCD_HEIGHT*5/4)
@@ -389,7 +387,9 @@ static int mandelbrot_zoom(int factor)
389 387
390 res = recalc_parameters(); 388 res = recalc_parameters();
391 if (res) /* zoom not possible, revert */ 389 if (res) /* zoom not possible, revert */
390 {
392 mandelbrot_zoom(-factor); 391 mandelbrot_zoom(-factor);
392 }
393 393
394 return res; 394 return res;
395} 395}