diff --git a/input/overlay.c b/input/overlay.c index 7f25ab6b64..52f56aec49 100644 --- a/input/overlay.c +++ b/input/overlay.c @@ -744,8 +744,6 @@ void input_overlay_poll(input_overlay_t *ol, input_overlay_state_t *out, int16_t x /= ol->active->mod_w; y /= ol->active->mod_h; - input_overlay_set_alpha_mod(ol, g_settings.input.overlay_opacity); - for (i = 0; i < ol->active->size; i++) { struct overlay_desc *desc = &ol->active->descs[i]; @@ -754,10 +752,6 @@ void input_overlay_poll(input_overlay_t *ol, input_overlay_state_t *out, int16_t desc->updated = true; - if (desc->image.image) - ol->iface->set_alpha(ol->iface_data, desc->image_index, - desc->alpha_mod * g_settings.input.overlay_opacity); - if (desc->type == OVERLAY_TYPE_BUTTONS) { uint64_t mask = desc->key_mask; @@ -783,10 +777,12 @@ void input_overlay_poll(input_overlay_t *ol, input_overlay_state_t *out, int16_t memset(out, 0, sizeof(*out)); } -void input_overlay_update_range_mod(input_overlay_t *ol) +void input_overlay_post_poll(input_overlay_t *ol) { size_t i; + input_overlay_set_alpha_mod(ol, g_settings.input.overlay_opacity); + for (i = 0; i < ol->active->size; i++) { struct overlay_desc *desc = &ol->active->descs[i]; @@ -796,6 +792,10 @@ void input_overlay_update_range_mod(input_overlay_t *ol) // If pressed this frame, change the hitbox. desc->range_x_mod = desc->range_x * desc->range_mod; desc->range_y_mod = desc->range_y * desc->range_mod; + + if (desc->image.image) + ol->iface->set_alpha(ol->iface_data, desc->image_index, + desc->alpha_mod * g_settings.input.overlay_opacity); } else { diff --git a/input/overlay.h b/input/overlay.h index 8bfe886511..4c9495f5bf 100644 --- a/input/overlay.h +++ b/input/overlay.h @@ -46,8 +46,8 @@ bool input_overlay_full_screen(input_overlay_t *ol); // norm_x and norm_y are the result of input_translate_coord_viewport(). void input_overlay_poll(input_overlay_t *ol, input_overlay_state_t *out, int16_t norm_x, int16_t norm_y); -// called after all the input_overlay_poll calls to update the range modifiers for pressed/unpressed regions -void input_overlay_update_range_mod(input_overlay_t *ol); +// called after all the input_overlay_poll calls to update the range modifiers for pressed/unpressed regions and alpha mods +void input_overlay_post_poll(input_overlay_t *ol); // Call when there is nothing to poll. Allows overlay to clear certain state. void input_overlay_poll_clear(input_overlay_t *ol); diff --git a/retroarch.c b/retroarch.c index cb7728e28d..6f9751a899 100644 --- a/retroarch.c +++ b/retroarch.c @@ -519,7 +519,7 @@ static inline void input_poll_overlay(void) } if (polled) - input_overlay_update_range_mod(driver.overlay); + input_overlay_post_poll(driver.overlay); else input_overlay_poll_clear(driver.overlay); }