Skip to content

Commit

Permalink
Apply guichan fix 79e81ca83f124b961eedfc7ecd5fd5618c5d97df (Jan 2nd 2…
Browse files Browse the repository at this point in the history
…008).

* A fix has been applied to correctly clamp a pushed clip area to the top clip area.
  • Loading branch information
Jarod42 committed Aug 3, 2024
1 parent 805365c commit 867354b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* Continue rebasing from b62d153a5dd699add2109671d4569578dd4f2671
* Continue rebasing from f385b61e8f328c325d72d84280670771672a6509
* Add a focus listener interface.
* Make focus apply synchronously.
* Graphics and input objects for DirectX.
Expand Down
16 changes: 9 additions & 7 deletions src/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,24 @@ namespace gcn
// Clamp the pushed clip rectangle.
if (carea.x < top.x)
{
carea.x = top.x;
carea.width += carea.x - top.x;
carea.x = top.x;
}

if (carea.y < top.y)
{
carea.y = top.y;
carea.height += carea.y - top.y;
carea.y = top.y;
}

if (carea.width > top.width)
{
carea.width = top.width;
carea.width = top.width;
}

if (carea.height > top.height)
{
carea.height = top.height;
carea.height = top.height;
}

bool result = carea.intersect(top);
Expand Down
6 changes: 4 additions & 2 deletions src/sdl/sdl2graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ namespace gcn
rect.y = carea.y;
rect.w = carea.width;
rect.h = carea.height;

SDL_RenderSetClipRect(mRenderTarget, &rect);
if (result)
{
SDL_RenderSetClipRect(mRenderTarget, &rect);
}

return result;
}
Expand Down

0 comments on commit 867354b

Please sign in to comment.