1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-22 15:23:01 +01:00

Revert DPI accessors

This commit is contained in:
Michael Bernardi
2024-09-27 01:46:46 +10:00
parent 570e1efc8c
commit 09fa68a803
46 changed files with 348 additions and 428 deletions

View File

@@ -1049,44 +1049,44 @@ static void WindowDrawSingle(DrawPixelInfo& dpi, WindowBase& w, int32_t left, in
DrawPixelInfo copy = dpi;
// Clamp left to 0
int32_t overflow = left - copy.ScreenX();
int32_t overflow = left - copy.x;
if (overflow > 0)
{
copy.SetX(copy.ScreenX() + overflow);
copy.SetWidth(copy.ScreenWidth() - overflow);
if (copy.ScreenWidth() <= 0)
copy.x += overflow;
copy.width -= overflow;
if (copy.width <= 0)
return;
copy.pitch += overflow;
copy.bits += overflow;
}
// Clamp width to right
overflow = copy.ScreenX() + copy.ScreenWidth() - right;
overflow = copy.x + copy.width - right;
if (overflow > 0)
{
copy.SetWidth(copy.ScreenWidth() - overflow);
if (copy.ScreenWidth() <= 0)
copy.width -= overflow;
if (copy.width <= 0)
return;
copy.pitch += overflow;
}
// Clamp top to 0
overflow = top - copy.ScreenY();
overflow = top - copy.y;
if (overflow > 0)
{
copy.SetY(copy.ScreenY() + overflow);
copy.SetHeight(copy.ScreenHeight() - overflow);
if (copy.ScreenHeight() <= 0)
copy.y += overflow;
copy.height -= overflow;
if (copy.height <= 0)
return;
copy.bits += copy.LineStride() * overflow;
}
// Clamp height to bottom
overflow = copy.ScreenY() + copy.ScreenHeight() - bottom;
overflow = copy.y + copy.height - bottom;
if (overflow > 0)
{
copy.SetHeight(copy.ScreenHeight() - overflow);
if (copy.ScreenHeight() <= 0)
copy.height -= overflow;
if (copy.height <= 0)
return;
}