diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-09-20 16:01:46 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-09-20 16:01:46 +0200 |
| commit | 5efde1e3e65af769cb629d55f0a4dd4f87caebe9 (patch) | |
| tree | 88c685fad561e39fac869a36a93e98866e2ccb62 /main.c | |
| parent | 95b209426dd7a9f844cf1aa093a2b1c4301f049b (diff) | |
| download | mandelbrot_cpu-5efde1e3e65af769cb629d55f0a4dd4f87caebe9.tar.gz mandelbrot_cpu-5efde1e3e65af769cb629d55f0a4dd4f87caebe9.tar.bz2 mandelbrot_cpu-5efde1e3e65af769cb629d55f0a4dd4f87caebe9.zip | |
Parallel computation, pixel array
- All the pixels are stored in an array, put in a surface then a texture
so we don't draw each pixel one by one.
- The computation of this array is done in parallel (one thread by line)
- Use sscanf instead of atoi hack to parse options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -4,9 +4,8 @@ #include <string.h> #include "header.h" -#define CHAR_SIZE sizeof(char) -#define DEFAULT_WINDOW_W 200 -#define DEFAULT_WINDOW_H 200 +#define DEFAULT_WINDOW_W 300 +#define DEFAULT_WINDOW_H 300 #define DEFAULT_CENTER_X 0.0 #define DEFAULT_CENTER_Y 0.0 #define DEFAULT_REAL_RANGE 4.0 @@ -41,20 +40,17 @@ int main(int argc, char **argv) exit(EXIT_SUCCESS); break; case 's': - config.window_w = atoi(optarg); - config.window_h = atoi(strstr(optarg, ",") + CHAR_SIZE); + sscanf(optarg, "%d,%d", &config.window_w, &config.window_h); break; case 'r': - config.real_range = atof(optarg); - config.imag_range = atof(strstr(optarg, ",") + CHAR_SIZE); + sscanf(optarg, "%lf,%lf", &config.real_range, &config.imag_range); break; case 'c': - config.center_x = atof(optarg); - config.center_y = atof(strstr(optarg, ",") + CHAR_SIZE); + sscanf(optarg, "%lf,%lf", &config.center_x, &config.center_y); break; case '?': default: - fprintf(stderr, "Usage %s [pwh]", argv[0]); + fprintf(stderr, "Try: %s -h for more information", argv[0]); exit(EXIT_FAILURE); } |
