Files
libreoffice/cui/source/dialogs/ImageViewerDialog.cxx
homeboy445 3057ee8ba0 Added support for viewing results in the VCL tests UI box
The user can now easily view the result of any VCL test
by just clicking on it - which would show them the resultant
bitmap of that corresponding test.

Change-Id: I57c0c2ab3662a9abec45ba7fc230c9299dcd9279
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117657
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-07-10 00:34:38 +02:00

25 lines
1.0 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <vcl/virdev.hxx>
#include <ImageViewerDialog.hxx>
ImageViewerDialog::ImageViewerDialog(weld::Dialog* pParent, BitmapEx aBitmap, OUString atitle)
: GenericDialogController(pParent, "cui/ui/imageviewer.ui", "ImageViewerDialog")
, m_xDisplayImage(m_xBuilder->weld_image("ImgVW_mainImage"))
{
m_xDialog->set_title(atitle);
aBitmap.Scale(Size(300, 300), BmpScaleFlag::Fast);
ScopedVclPtr<VirtualDevice> m_pVirDev = m_xDisplayImage->create_virtual_device();
m_pVirDev->SetOutputSizePixel(aBitmap.GetSizePixel());
m_pVirDev->DrawBitmapEx(Point(0, 0), aBitmap);
m_xDisplayImage->set_image(m_pVirDev.get());
m_pVirDev.disposeAndClear();
}