Preserve aspect ratio of the screenshot in the preview. (Ticket #3821)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30457 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2ae836dbe0
commit
2002f6f626
@ -502,6 +502,21 @@ ScreenshotWindow::_CenterAndShow()
|
||||
void
|
||||
ScreenshotWindow::_UpdatePreviewPanel()
|
||||
{
|
||||
float height = 150.0f;
|
||||
|
||||
float width = (fScreenshot->Bounds().Width() /
|
||||
fScreenshot->Bounds().Height()) * height;
|
||||
|
||||
// to prevent a preview way too wide
|
||||
if (width > 400.0f) {
|
||||
width = 400.0f;
|
||||
height = (fScreenshot->Bounds().Height() /
|
||||
fScreenshot->Bounds().Width()) * width;
|
||||
}
|
||||
|
||||
fPreviewBox->SetExplicitMinSize(BSize(width, height));
|
||||
fPreviewBox->SetExplicitMaxSize(BSize(width, height));
|
||||
|
||||
fPreviewBox->ClearViewBitmap();
|
||||
fPreviewBox->SetViewBitmap(fScreenshot, fScreenshot->Bounds(),
|
||||
fPreviewBox->Bounds(), B_FOLLOW_ALL, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user