From 4f5f0fc36cc7f34fad05e45671dfa7b8dc32fd51 Mon Sep 17 00:00:00 2001 From: Michael Fitzmayer Date: Mon, 2 May 2022 21:02:30 +0200 Subject: [PATCH] N-Gage: disable clipping for the time being, issue needs to be resolved later --- src/render/software/SDL_render_sw.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index a1af12cd67..38c826a1f8 100644 --- a/src/render/software/SDL_render_sw.c +++ b/src/render/software/SDL_render_sw.c @@ -663,6 +663,7 @@ SetDrawState(SDL_Surface *surface, SW_DrawStateCache *drawstate) const SDL_Rect *cliprect = drawstate->cliprect; SDL_assert(viewport != NULL); /* the higher level should have forced a SDL_RENDERCMD_SETVIEWPORT */ +#ifndef __NGAGE__ if (cliprect != NULL) { SDL_Rect clip_rect; clip_rect.x = cliprect->x + viewport->x; @@ -674,6 +675,24 @@ SetDrawState(SDL_Surface *surface, SW_DrawStateCache *drawstate) } else { SDL_SetClipRect(surface, drawstate->viewport); } +#else + if (SDL_RectEmpty(drawstate->viewport)) + { + viewport = NULL; + } + + if (cliprect != NULL && viewport != NULL) { + SDL_Rect clip_rect; + clip_rect.x = cliprect->x + viewport->x; + clip_rect.y = cliprect->y + viewport->y; + clip_rect.w = cliprect->w; + clip_rect.h = cliprect->h; + SDL_IntersectRect(viewport, &clip_rect, &clip_rect); + SDL_SetClipRect(surface, &clip_rect); + } else { + SDL_SetClipRect(surface, viewport); + } +#endif drawstate->surface_cliprect_dirty = SDL_FALSE; } }