summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-07 20:27:51 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-07-08 13:39:11 +0200
commit19fd82ac6e08896bd17169d1b6ea090458fc18da (patch)
treea179a2651dc58d4574833ac39ab0ea70f1dd8110 /vcl/source
parent2d8e2813ddc87f7ce03b97e4d603df11613461f0 (diff)
distinguish between dialog screenshoting and rendering a widget
Change-Id: I43ee0c68d72c97a15d26e2ffea577c2a44ba91e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98326 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/app/salvtables.cxx12
-rw-r--r--vcl/source/window/syswin.cxx12
2 files changed, 15 insertions, 9 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index f3778f91340c..81c2e38085c3 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1133,10 +1133,12 @@ std::unique_ptr<weld::Container> SalInstanceWidget::weld_parent() const
return std::make_unique<SalInstanceContainer>(pParent, m_pBuilder, false);
}
-void SalInstanceWidget::draw(VirtualDevice& rOutput)
+void SalInstanceWidget::draw(OutputDevice& rOutput, const tools::Rectangle& rRect)
{
- rOutput.SetOutputSizePixel(m_xWidget->GetSizePixel());
- m_xWidget->PaintToDevice(&rOutput, Point());
+ Size aOrigSize(m_xWidget->GetSizePixel());
+ m_xWidget->SetSizePixel(rRect.GetSize());
+ m_xWidget->Draw(&rOutput, rRect.TopLeft(), DrawFlags::NONE);
+ m_xWidget->SetSizePixel(aOrigSize);
}
namespace
@@ -1321,11 +1323,11 @@ void SalInstanceWindow::HandleEventListener(VclWindowEvent& rEvent)
SalInstanceContainer::HandleEventListener(rEvent);
}
-void SalInstanceWindow::draw(VirtualDevice& rOutput)
+VclPtr<VirtualDevice> SalInstanceWindow::screenshot()
{
SystemWindow* pSysWin = dynamic_cast<SystemWindow*>(m_xWindow.get());
assert(pSysWin);
- pSysWin->createScreenshot(rOutput);
+ return pSysWin->createScreenshot();
}
weld::ScreenShotCollection SalInstanceWindow::collect_screenshot_data()
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 3c154dd228c7..a3f5a2a933fd 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -1156,7 +1156,7 @@ void SystemWindow::doDeferredInit(WinBits /*nBits*/)
SAL_WARN("vcl.layout", "SystemWindow in layout without doDeferredInit impl");
}
-void SystemWindow::createScreenshot(VirtualDevice& rOutput)
+VclPtr<VirtualDevice> SystemWindow::createScreenshot()
{
// same prerequisites as in Execute()
setDeferredProperties();
@@ -1165,11 +1165,15 @@ void SystemWindow::createScreenshot(VirtualDevice& rOutput)
ToTop();
ensureRepaint();
- Point aPos;
Size aSize(GetOutputSizePixel());
- rOutput.SetOutputSizePixel(aSize);
- rOutput.DrawOutDev(aPos, aSize, aPos, aSize, *this);
+ VclPtr<VirtualDevice> xOutput(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
+ xOutput->SetOutputSizePixel(aSize);
+
+ Point aPos;
+ xOutput->DrawOutDev(aPos, aSize, aPos, aSize, *this);
+
+ return xOutput;
}
void SystemWindow::PrePaint(vcl::RenderContext& rRenderContext)