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 <[email protected]>
This commit is contained in:
committed by
Augustin Cavalier
parent
d6f83df4bb
commit
5dab45be76
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user