diff --git a/src/docs/HISTORY.md b/src/docs/HISTORY.md index 8adbd11b6..991146748 100644 --- a/src/docs/HISTORY.md +++ b/src/docs/HISTORY.md @@ -23,7 +23,7 @@ v1.2.8 the command-line. - Fixed ICS pulldown not showing None when switching to a clip with no Input Color Space stored. -- Fixed viewport/image ratio calculation in Save Move/Save Single Frame. +- Fixed viewport/image rescaling calculation in Save Move/Save Single Frame. - Fixed Save Resolution setting being set to Half Size when Save Annotations was on. - Made Status Bar error/warnings remain longer (8 seconds instead of 5). diff --git a/src/lib/mrvFl/mrvSaveImage.cpp b/src/lib/mrvFl/mrvSaveImage.cpp index ff308a05a..87be7a00d 100644 --- a/src/lib/mrvFl/mrvSaveImage.cpp +++ b/src/lib/mrvFl/mrvSaveImage.cpp @@ -223,28 +223,16 @@ namespace mrv view->frameView(); - double viewportRatio = - viewportSize.w / - static_cast(viewportSize.h); - double imageRatio = - renderSize.w / static_cast(renderSize.h); - - if (viewportRatio < imageRatio) - { - double factor = viewportSize.h / - static_cast(renderSize.h); - outputInfo.size.w = - std::round(renderSize.w * factor); - outputInfo.size.h = viewportSize.h; - } - else + double zoom = + viewportSize.h / static_cast(renderSize.h); + + if (zoom * renderSize.w > viewportSize.w) { - double factor = viewportSize.w / - static_cast(renderSize.w); - outputInfo.size.h = - std::round(renderSize.h * factor); - outputInfo.size.w = viewportSize.w; + zoom = viewportSize.w / static_cast(renderSize.w); } + + outputInfo.size.w = std::round(renderSize.w * zoom); + outputInfo.size.h = std::round(renderSize.h * zoom); } X = (viewportSize.w - outputInfo.size.w) / 2; diff --git a/src/lib/mrvFl/mrvSaveMovie.cpp b/src/lib/mrvFl/mrvSaveMovie.cpp index 49f010fc1..8fc369663 100644 --- a/src/lib/mrvFl/mrvSaveMovie.cpp +++ b/src/lib/mrvFl/mrvSaveMovie.cpp @@ -463,28 +463,16 @@ namespace mrv view->frameView(); - double viewportRatio = - viewportSize.w / - static_cast(viewportSize.h); - double imageRatio = - renderSize.w / static_cast(renderSize.h); - - if (viewportRatio < imageRatio) - { - double factor = viewportSize.h / - static_cast(renderSize.h); - outputInfo.size.w = - std::round(renderSize.w * factor); - outputInfo.size.h = viewportSize.h; - } - else + double zoom = + viewportSize.h / static_cast(renderSize.h); + + if (zoom * renderSize.w > viewportSize.w) { - double factor = viewportSize.w / - static_cast(renderSize.w); - outputInfo.size.h = - std::round(renderSize.h * factor); - outputInfo.size.w = viewportSize.w; + zoom = viewportSize.w / static_cast(renderSize.w); } + + outputInfo.size.w = std::round(renderSize.w * zoom); + outputInfo.size.h = std::round(renderSize.h * zoom); } X = (viewportSize.w - outputInfo.size.w) / 2;