aboutsummaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-05-22 17:42:39 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-22 17:42:39 +0200
commit9ab34fff22bb2d6ebedefc702f7ec6c55937e175 (patch)
tree311aae03ddf5ac62cb1c0b678eda954a7fa5f15a /src/state.c
parent6d4c3864e3b742a92e9874f1e4dfe3a9c1565188 (diff)
downloadmandelbrot_cpu-master.tar.gz
mandelbrot_cpu-master.tar.bz2
mandelbrot_cpu-master.zip
AVX draftHEADmaster
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/src/state.c b/src/state.c
index c1bdacb..b0bc38b 100644
--- a/src/state.c
+++ b/src/state.c
@@ -47,36 +47,16 @@ void state_run(State *state)
{
event_handle(state);
- double real_step;
- double imag_step;
- double real;
- double imag;
+ int _;
void *pixels;
- int pitch;
int width;
int height;
- SDL_CALL(SDL_LockTexture(state->texture, NULL, &pixels, &pitch));
+ SDL_CALL(SDL_LockTexture(state->texture, NULL, &pixels, &_));
SDL_CALL(SDL_QueryTexture(state->texture, NULL, NULL, &width, &height));
- real_step = (state->real_end - state->real_start) / width;
- imag_step = (state->imag_end - state->imag_start) / height;
- imag = state->imag_start;
-
uint32_t render_start_time = SDL_GetTicks();
-
- for (int i = 0; i < height; i++)
- {
- real = state->real_start;
- for (int j = 0; j < width; j++)
- {
- int n = mandelbrot(real, imag, state->iterations);
- ((Color*)pixels)[i * width + j] = state->palette[n];
- real += real_step;
- }
- imag += imag_step;
- }
-
+ mandelbrot_avx(state, pixels, width, height);
uint32_t render_end_time = SDL_GetTicks();
SDL_UnlockTexture(state->texture);