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:
@@ -502,6 +502,21 @@ ScreenshotWindow::_CenterAndShow()
|
|||||||
void
|
void
|
||||||
ScreenshotWindow::_UpdatePreviewPanel()
|
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->ClearViewBitmap();
|
||||||
fPreviewBox->SetViewBitmap(fScreenshot, fScreenshot->Bounds(),
|
fPreviewBox->SetViewBitmap(fScreenshot, fScreenshot->Bounds(),
|
||||||
fPreviewBox->Bounds(), B_FOLLOW_ALL, 0);
|
fPreviewBox->Bounds(), B_FOLLOW_ALL, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user