mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-28 09:31:36 +00:00
render: an empty clip rect should clip all drawing
Added a test to validate this and fixed the Metal renderer
Fixes https://github.com/libsdl-org/SDL/issues/15434
(cherry picked from commit e04bfb4c6e)
This commit is contained in:
@@ -1538,14 +1538,14 @@ static bool SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, c
|
||||
METAL_GetOutputSize(renderer, &output.w, &output.h);
|
||||
}
|
||||
|
||||
if (SDL_GetRectIntersection(&output, &clip, &clip)) {
|
||||
MTLScissorRect mtlrect;
|
||||
mtlrect.x = clip.x;
|
||||
mtlrect.y = clip.y;
|
||||
mtlrect.width = clip.w;
|
||||
mtlrect.height = clip.h;
|
||||
[data.mtlcmdencoder setScissorRect:mtlrect];
|
||||
}
|
||||
SDL_GetRectIntersection(&output, &clip, &clip);
|
||||
|
||||
MTLScissorRect mtlrect;
|
||||
mtlrect.x = clip.x;
|
||||
mtlrect.y = clip.y;
|
||||
mtlrect.width = clip.w;
|
||||
mtlrect.height = clip.h;
|
||||
[data.mtlcmdencoder setScissorRect:mtlrect];
|
||||
|
||||
statecache->cliprect_dirty = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user