aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-12-25 05:21:42 -0800
committerChris Robinson <[email protected]>2023-12-25 05:21:42 -0800
commitec914e895ff6d7bf2d19e8c8785e5d8bfd38629f (patch)
tree80a5efc31bbc88d76bce3e7116d27dcf14390870 /examples
parentdae225e88dbf795e776a2c9f2dbe5bb07c2228b9 (diff)
Use standard methods for rounding
Diffstat (limited to 'examples')
-rw-r--r--examples/alffplay.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/alffplay.cpp b/examples/alffplay.cpp
index 890ecedb..a7633bfa 100644
--- a/examples/alffplay.cpp
+++ b/examples/alffplay.cpp
@@ -1509,9 +1509,9 @@ void VideoState::updateVideo(SDL_Window *screen, SDL_Renderer *renderer, bool re
{
double aspect_ratio = av_q2d(frame->sample_aspect_ratio);
if(aspect_ratio >= 1.0)
- frame_width = static_cast<int>(frame_width*aspect_ratio + 0.5);
+ frame_width = static_cast<int>(std::lround(frame_width * aspect_ratio));
else if(aspect_ratio > 0.0)
- frame_height = static_cast<int>(frame_height/aspect_ratio + 0.5);
+ frame_height = static_cast<int>(std::lround(frame_height / aspect_ratio));
}
SDL_SetWindowSize(screen, frame_width, frame_height);
}