Skip to content

Commit

Permalink
Fixed clip rect when logical presentation is enabled
Browse files Browse the repository at this point in the history
We don't need to include the logical offset, it's already included in the viewport.

Fixes #12454

(cherry picked from commit 4bb46e9)
  • Loading branch information
slouken committed Mar 4, 2025
1 parent 5a7b17f commit d959719
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/render/SDL_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ static void UpdatePixelClipRect(SDL_Renderer *renderer, SDL_RenderViewState *vie
{
const float scale_x = view->current_scale.x;
const float scale_y = view->current_scale.y;
view->pixel_clip_rect.x = (int)SDL_floorf((view->clip_rect.x * scale_x) + view->logical_offset.x);
view->pixel_clip_rect.y = (int)SDL_floorf((view->clip_rect.y * scale_y) + view->logical_offset.y);
view->pixel_clip_rect.x = (int)SDL_floorf(view->clip_rect.x * scale_x);
view->pixel_clip_rect.y = (int)SDL_floorf(view->clip_rect.y * scale_y);
view->pixel_clip_rect.w = (int)SDL_ceilf(view->clip_rect.w * scale_x);
view->pixel_clip_rect.h = (int)SDL_ceilf(view->clip_rect.h * scale_y);
}
Expand Down

0 comments on commit d959719

Please sign in to comment.