Ensure we update only modified rects

This commit is contained in:
Francesco Abbate 2021-04-27 09:52:02 +02:00
parent f2a33a567b
commit 8b9fbecd74
1 changed files with 5 additions and 2 deletions

View File

@ -176,9 +176,12 @@ void ren_update_rects(RenRect *rects, int count) {
initial_frame = false;
}
// FIXME: we ignore the rects here.
SDL_UpdateTexture(renderer.texture, NULL, renderer.surface->pixels, renderer.surface->w * 4);
SDL_RenderCopy(renderer.renderer, renderer.texture, NULL, NULL);
for (int i = 0; i < count; i++) {
const RenRect *r = &rects[i];
SDL_Rect sr = {.x = r->x, .y = r->y, .w = r->width, .h = r->height};
SDL_RenderCopy(renderer.renderer, renderer.texture, &sr, &sr);
}
SDL_RenderPresent(renderer.renderer);
}