From 9b0ff1fd0d5aa43fb89d686f1d0f929145eba5d9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 7 Mar 2020 20:53:39 +0100 Subject: [PATCH] (gfx_display.c) Cleanup --- gfx/gfx_display.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gfx/gfx_display.c b/gfx/gfx_display.c index 6c70e44f07..5d8f6117a1 100644 --- a/gfx/gfx_display.c +++ b/gfx/gfx_display.c @@ -649,6 +649,9 @@ void gfx_display_blend_end(video_frame_info_t *video_info) void gfx_display_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height) { + unsigned video_width = video_info->width; + unsigned video_height = video_info->height; + if (dispctx && dispctx->scissor_begin) { if (y < 0) @@ -667,20 +670,20 @@ void gfx_display_scissor_begin(video_frame_info_t *video_info, width += x; x = 0; } - if (y >= (int)video_info->height) + if (y >= (int)video_height) { height = 0; y = 0; } - if (x >= (int)video_info->width) + if (x >= (int)video_width) { width = 0; x = 0; } - if ((y + height) > video_info->height) - height = video_info->height - y; - if ((x + width) > video_info->width) - width = video_info->width - x; + if ((y + height) > video_height) + height = video_height - y; + if ((x + width) > video_width) + width = video_width - x; dispctx->scissor_begin(video_info, x, y, width, height); }