diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2014-10-26 10:43:07 +0300 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2014-10-27 01:03:28 +0300 |
commit | 5a8ee10ee89638e6ac20b6bfe4c2edf2a4e4a260 (patch) | |
tree | 86d22555ce13af7fecc483f5e5cc5e27fd2c970a | |
parent | 333b161707a426b224e42cf94ad3f969c5911276 (diff) |
Do not adjust window size for video frame aspect ratio when video size
is independent from window size.
This fixes the case when scaled video frame size is bigger than work
area and we want to have bigger viewport.
-rw-r--r-- | src/mpc-hc/MainFrm.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mpc-hc/MainFrm.cpp b/src/mpc-hc/MainFrm.cpp index 8bc4da2d7..301914fcf 100644 --- a/src/mpc-hc/MainFrm.cpp +++ b/src/mpc-hc/MainFrm.cpp @@ -9912,14 +9912,22 @@ CSize CMainFrame::GetZoomWindowSize(double dScale) // don't go larger than the current monitor working area and prevent black bars in this case
CSize videoSpaceSize = workRect.Size() - controlsSize - decorationsRect.Size();
+ // Do not adjust window size for video frame aspect ratio when video size is independent from window size
+ const bool bAdjustWindowAR = !(s.iDefaultVideoSize == DVS_HALF || s.iDefaultVideoSize == DVS_NORMAL || s.iDefaultVideoSize == DVS_DOUBLE);
+ const double videoAR = videoSize.cx / (double)videoSize.cy;
+
if (videoTargetSize.cx > videoSpaceSize.cx) {
videoTargetSize.cx = videoSpaceSize.cx;
- videoTargetSize.cy = std::lround(videoSpaceSize.cx * videoSize.cy / (double)videoSize.cx);
+ if (bAdjustWindowAR) {
+ videoTargetSize.cy = std::lround(videoSpaceSize.cx / videoAR);
+ }
}
if (videoTargetSize.cy > videoSpaceSize.cy) {
videoTargetSize.cy = videoSpaceSize.cy;
- videoTargetSize.cx = std::lround(videoSpaceSize.cy * videoSize.cx / (double)videoSize.cy);
+ if (bAdjustWindowAR) {
+ videoTargetSize.cx = std::lround(videoSpaceSize.cy * videoAR);
+ }
}
} else {
ASSERT(FALSE);
|