Skip to content

Commit

Permalink
SDL renderer: Use to_sdl() method of Rect class more
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Apr 27, 2024
1 parent d8de4af commit d10ab0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/video/sdl/sdl_painter.cpp
Expand Up @@ -592,10 +592,7 @@ SDLPainter::clear(const Color& color)
void
SDLPainter::set_clip_rect(const Rect& rect)
{
m_cliprect = SDL_Rect{ rect.left,
rect.top,
rect.get_width(),
rect.get_height() };
m_cliprect = rect.to_sdl();

int ret = SDL_RenderSetClipRect(m_sdl_renderer, &*m_cliprect);
if (ret < 0)
Expand Down
3 changes: 1 addition & 2 deletions src/video/sdl/sdl_screen_renderer.cpp
Expand Up @@ -62,8 +62,7 @@ SDLScreenRenderer::start_draw()
const Rect& viewport = m_video_system.get_viewport().get_rect();
const Vector& scale = m_video_system.get_viewport().get_scale();

SDL_Rect sdl_viewport = { viewport.left, viewport.top,
viewport.get_width(), viewport.get_height() };
SDL_Rect sdl_viewport = viewport.to_sdl();

// SetViewport() works in scaled screen coordinates, so we have to
// reset it to 1.0, 1.0 to get meaningful results
Expand Down

0 comments on commit d10ab0d

Please sign in to comment.