summaryrefslogtreecommitdiff
path: root/apps/plugins/mandelbrot.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/mandelbrot.c')
-rw-r--r--apps/plugins/mandelbrot.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/apps/plugins/mandelbrot.c b/apps/plugins/mandelbrot.c
index 3585af80f9..3c948e8130 100644
--- a/apps/plugins/mandelbrot.c
+++ b/apps/plugins/mandelbrot.c
@@ -38,10 +38,10 @@ static int delta;
38static int max_iter; 38static int max_iter;
39 39
40void init_mandelbrot_set(void){ 40void init_mandelbrot_set(void){
41 x_min = -5<<27; // -2.5<<28 41 x_min = -5<<25; // -2.5<<26
42 x_max = 1<<28; // 1.0<<28 42 x_max = 1<<26; // 1.0<<26
43 y_min = -1<<28; // -1.0<<28 43 y_min = -1<<26; // -1.0<<26
44 y_max = 1<<28; // 1.0<<28 44 y_max = 1<<26; // 1.0<<26
45 delta = (x_max - x_min) >> 3; // /8 45 delta = (x_max - x_min) >> 3; // /8
46 max_iter = 25; 46 max_iter = 25;
47} 47}
@@ -71,12 +71,12 @@ void calc_mandelbrot_set(void){
71 n_iter = 0; 71 n_iter = 0;
72 72
73 while (++n_iter<=max_iter) { 73 while (++n_iter<=max_iter) {
74 x >>= 14; 74 x >>= 13;
75 y >>= 14; 75 y >>= 13;
76 x2 = x * x; 76 x2 = x * x;
77 y2 = y * y; 77 y2 = y * y;
78 78
79 if (x2 + y2 > (4<<28)) break; 79 if (x2 + y2 > (4<<26)) break;
80 80
81 y = 2 * x * y + b; 81 y = 2 * x * y + b;
82 x = x2 - y2 + a; 82 x = x2 - y2 + a;
@@ -114,7 +114,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
114 rb = api; 114 rb = api;
115 115
116 init_mandelbrot_set(); 116 init_mandelbrot_set();
117 lcd_aspect_ratio = ((LCD_WIDTH<<14) / LCD_HEIGHT)<<14; 117 lcd_aspect_ratio = ((LCD_WIDTH<<13) / LCD_HEIGHT)<<13;
118 118
119 /* main loop */ 119 /* main loop */
120 while (true){ 120 while (true){
@@ -132,8 +132,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
132 return PLUGIN_OK; 132 return PLUGIN_OK;
133 133
134 case BUTTON_ON: 134 case BUTTON_ON:
135 x_min -= ((delta>>14)*(lcd_aspect_ratio>>14)); 135 x_min -= ((delta>>13)*(lcd_aspect_ratio>>13));
136 x_max += ((delta>>14)*(lcd_aspect_ratio>>14)); 136 x_max += ((delta>>13)*(lcd_aspect_ratio>>13));
137 y_min -= delta; 137 y_min -= delta;
138 y_max += delta; 138 y_max += delta;
139 delta = (x_max - x_min) >> 3; 139 delta = (x_max - x_min) >> 3;
@@ -141,8 +141,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
141 141
142 142
143 case BUTTON_PLAY: 143 case BUTTON_PLAY:
144 x_min += ((delta>>14)*(lcd_aspect_ratio>>14)); 144 x_min += ((delta>>13)*(lcd_aspect_ratio>>13));
145 x_max -= ((delta>>14)*(lcd_aspect_ratio>>14)); 145 x_max -= ((delta>>13)*(lcd_aspect_ratio>>13));
146 y_min += delta; 146 y_min += delta;
147 y_max -= delta; 147 y_max -= delta;
148 delta = (x_max - x_min) >> 3; 148 delta = (x_max - x_min) >> 3;