Skip to content

Commit

Permalink
Screenshot: Fix aspect ratio.
Browse files Browse the repository at this point in the history
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 <waddlesplash@gmail.com>
  • Loading branch information
TwoFX authored and waddlesplash committed Jul 25, 2015
1 parent d6f83df commit 5dab45b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/apps/screenshot/ScreenshotWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ ScreenshotWindow::ScreenshotWindow(const Utility& utility, bool silent,

saveScreenshot->MakeDefault(true);

Layout(false);
_UpdatePreviewPanel();
_UpdateFilenameSelection();

Expand Down Expand Up @@ -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;

Expand All @@ -451,6 +452,7 @@ ScreenshotWindow::_UpdatePreviewPanel()
}

fPreview->SetExplicitMinSize(BSize(width, height));
fPreview->SetExplicitMaxSize(BSize(width, height));

fPreview->ClearViewBitmap();
fPreview->SetViewBitmap(fScreenshot, fScreenshot->Bounds(),
Expand Down

0 comments on commit 5dab45b

Please sign in to comment.