Skip to content

Commit

Permalink
Remove hardcoded 1 pixel
Browse files Browse the repository at this point in the history
  • Loading branch information
Benau committed May 17, 2024
1 parent 02e540b commit fcd8cea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/graphics/irr_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,12 @@ core::recti IrrDriver::getSplitscreenWindow(int window_num)
int col = window_num % columns;
// Calculate the top-left corner of the viewport
int viewport_x = col * base_viewport_width + std::min(col, extra_width);
int viewport_y = row * base_viewport_height + std::min(row, extra_height);
int viewport_x = col * base_viewport_width;
int viewport_y = row * base_viewport_height;
// Adjust width and height to fully occupy the remaining pixels
int viewport_width = base_viewport_width + (col < extra_width ? 1 : 0);
int viewport_height = base_viewport_height + (row < extra_height ? 1 : 0);
int viewport_width = base_viewport_width + (col == columns - 1 ? extra_width : 0);
int viewport_height = base_viewport_height + (row == rows - 1 ? extra_height : 0);
return core::recti(core::position2di(viewport_x, viewport_y),
core::dimension2du(viewport_width, viewport_height));
Expand Down

0 comments on commit fcd8cea

Please sign in to comment.