From 5dab45be766adf3716d356b8c7fa5858548f6d90 Mon Sep 17 00:00:00 2001 From: Markus Himmel Date: Sat, 25 Jul 2015 18:35:06 +0000 Subject: [PATCH] Screenshot: Fix aspect ratio. The aspect ratio of the preview was wrong for two reasons: * The height of the preview was always assumed to be 150 while it actually depends on the layout. * The size was then only set using SetExplicitMinSize(), which is not sufficient to actually change the size to the desired value. Fixes #11644. Signed-off-by: Augustin Cavalier --- src/apps/screenshot/ScreenshotWindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/apps/screenshot/ScreenshotWindow.cpp b/src/apps/screenshot/ScreenshotWindow.cpp index 796c1bc49b..e15a930a5b 100644 --- a/src/apps/screenshot/ScreenshotWindow.cpp +++ b/src/apps/screenshot/ScreenshotWindow.cpp @@ -239,6 +239,7 @@ ScreenshotWindow::ScreenshotWindow(const Utility& utility, bool silent, saveScreenshot->MakeDefault(true); + Layout(false); _UpdatePreviewPanel(); _UpdateFilenameSelection(); @@ -439,7 +440,7 @@ ScreenshotWindow::_NewScreenshot(bool silent, bool clipboard) void ScreenshotWindow::_UpdatePreviewPanel() { - float height = 150.0f; + float height = fPreview->Bounds().Height(); float width = (fScreenshot->Bounds().Width() / fScreenshot->Bounds().Height()) * height; @@ -451,6 +452,7 @@ ScreenshotWindow::_UpdatePreviewPanel() } fPreview->SetExplicitMinSize(BSize(width, height)); + fPreview->SetExplicitMaxSize(BSize(width, height)); fPreview->ClearViewBitmap(); fPreview->SetViewBitmap(fScreenshot, fScreenshot->Bounds(),