From 708a54d3de31ef76f524baeb0f5c2697589e93d7 Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Wed, 20 Jun 2018 21:57:34 +0200 Subject: Fix yellow for LCD_DEPTH == 32 Change-Id: I59e9ec8720555c17e882a3a8c7ed0ba281b8d7c7 --- apps/plugins/fractals/mandelbrot_set.c | 7 +++++++ 1 file changed, 7 insertions(+) (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 583095913f..69485d405a 100644 --- a/apps/plugins/fractals/mandelbrot_set.c +++ b/apps/plugins/fractals/mandelbrot_set.c @@ -39,8 +39,15 @@ static fb_data imgbuffer[LCD_HEIGHT]; * 345 (=15*26-45) is max_iter maximal value * This implementation ignores pixel format, thus it is not uniformly spread */ +#if LCD_DEPTH > 24 +/* when LCD_DEPTH is 32 casting to 64bit intermediate is needed to prevent + * overflow and warning 'left shift count >= width of type' + */ +#define LCOLOR(iter) ((unsigned int)(((unsigned long long)iter << LCD_DEPTH) / 345)) +#else #define LCOLOR(iter) ((iter << LCD_DEPTH) / 345) #endif +#endif #ifdef HAVE_LCD_COLOR #define COLOR(iter) FB_SCALARPACK(LCOLOR(iter)) -- cgit v1.2.3