SetFramebufferAsTarget: Avoid re-setting the same target bitmap

This commit is contained in:
Sebastian Krzyszkowiak 2020-11-11 02:07:28 +01:00
parent 86fef86257
commit d26adecc8e
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -573,7 +573,9 @@ SYMBOL_EXPORT ALLEGRO_BITMAP* GetFramebuffer(struct Game* game) {
SYMBOL_EXPORT void SetFramebufferAsTarget(struct Game* game) {
ALLEGRO_BITMAP* framebuffer = GetFramebuffer(game);
al_set_target_bitmap(framebuffer);
if (al_get_target_bitmap() != framebuffer) {
al_set_target_bitmap(framebuffer);
}
if (framebuffer != al_get_backbuffer(game->display)) {
double x = al_get_bitmap_width(framebuffer) / (double)game->viewport.width;
double y = al_get_bitmap_height(framebuffer) / (double)game->viewport.height;