Skip to content
Permalink
Browse files
Merge pull request #6786 from stenzek/crop-negative-y
RenderBase: Ensure the draw size does not exceed the window size
  • Loading branch information
degasus committed May 13, 2018
2 parents 66c1b90 + fd5aaa0 commit c267262
Showing 1 changed file with 4 additions and 0 deletions.
@@ -534,6 +534,10 @@ void Renderer::UpdateDrawRectangle()
crop_width = win_width;
}

// Clamp the draw width/height to the screen size, to ensure we don't render off-screen.
draw_width = std::min(draw_width, win_width);
draw_height = std::min(draw_height, win_height);

// ensure divisibility by 4 to make it compatible with all the video encoders
draw_width = std::ceil(draw_width) - static_cast<int>(std::ceil(draw_width)) % 4;
draw_height = std::ceil(draw_height) - static_cast<int>(std::ceil(draw_height)) % 4;

0 comments on commit c267262

Please sign in to comment.