diff options
-rw-r--r-- | src/ft_draw_scene.c | 4 | ||||
-rw-r--r-- | src/ft_save_to_bmp.c | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c index 9461eef..79124f4 100644 --- a/src/ft_draw_scene.c +++ b/src/ft_draw_scene.c @@ -25,6 +25,8 @@ void ft_castray(clist); if (clist->ishud) ft_draw_hud(clist); + if (ft_save_to_bmp(clist) < 0) + ft_error(FT_RET_BMP_ERR, FT_ERR_WR_BMP, clist); mlx_put_image_to_window(clist->wlist.wlx, clist->wlist.winptr, clist->img.img, 0, 0); mlx_destroy_image(clist->wlist.wlx, clist->img.img); @@ -38,7 +40,5 @@ void clist->img.ptr = mlx_get_data_addr(clist->img.img, &clist->img.bpp, &clist->img.sizeline, &clist->img.endian); ft_castray(clist); - if (ft_save_to_bmp(clist) < 0) - ft_error(FT_RET_BMP_ERR, FT_ERR_WR_BMP, clist); mlx_destroy_image(clist->wlist.wlx, clist->img.img); } diff --git a/src/ft_save_to_bmp.c b/src/ft_save_to_bmp.c index 7d242c6..bc4547a 100644 --- a/src/ft_save_to_bmp.c +++ b/src/ft_save_to_bmp.c @@ -52,6 +52,7 @@ static uint8_t uint32_t x; uint32_t i; + (void)img; if (!(bmp = (uint8_t*)malloc((3 * cl->wlist.x_size * cl->wlist.y_size) * sizeof(uint8_t)))) return (NULL); @@ -62,7 +63,7 @@ static uint8_t x = -1; while (++x < cl->wlist.x_size) { - px = ft_hex_to_rgb(*(int*)(img.ptr + (x * 4 + (y * img.sizeline)))); + px = ft_hex_to_rgb(*(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline)))); *(bmp + i++) = (uint8_t)px.b; *(bmp + i++) = (uint8_t)px.g; *(bmp + i++) = (uint8_t)px.r; |