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>
This commit is contained in:
Caolán McNamara
2020-07-08 13:39:11 +02:00
parent 2d8e2813dd
commit 19fd82ac6e
11 changed files with 86 additions and 96 deletions
@@ -205,8 +205,7 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl(
maPicture(this),
maSaveAsText(CuiResId(RID_SVXSTR_SAVE_SCREENSHOT_AS))
{
VclPtr<VirtualDevice> xParentDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
rParentDialog.draw(*xParentDialogSurface);
VclPtr<VirtualDevice> xParentDialogSurface(rParentDialog.screenshot());
maParentDialogSize = xParentDialogSurface->GetOutputSizePixel();
maParentDialogBitmap = xParentDialogSurface->GetBitmapEx(Point(), maParentDialogSize);
maDimmedDialogBitmap = maParentDialogBitmap;
+1 -1
View File
@@ -217,7 +217,7 @@ public:
virtual void doDeferredInit(WinBits nBits);
// Screenshot interface
void createScreenshot(VirtualDevice& rOutput);
VclPtr<VirtualDevice> createScreenshot();
};
inline void SystemWindow::SetIdleDebugName( const char *pDebugName )
+4 -1
View File
@@ -272,7 +272,7 @@ public:
virtual void connect_get_property_tree(const Link<tools::JsonWriter&, void>& rLink) = 0;
// render the widget to an output device
virtual void draw(VirtualDevice& rOutput) = 0;
virtual void draw(OutputDevice& rOutput, const tools::Rectangle& rRect) = 0;
virtual ~Widget() {}
};
@@ -468,6 +468,9 @@ public:
// collect positions of widgets and their help ids for screenshot purposes
virtual ScreenShotCollection collect_screenshot_data() = 0;
// render the widget to an output device
virtual VclPtr<VirtualDevice> screenshot() = 0;
};
class VCL_DLLPUBLIC WaitObject
+14 -28
View File
@@ -128,8 +128,7 @@ short AbstractScDataFormDlg_Impl::Execute()
BitmapEx AbstractScDataFormDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -185,8 +184,7 @@ short AbstractScMoveTableDlg_Impl::Execute()
BitmapEx AbstractScMoveTableDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -291,8 +289,7 @@ void AbstractScImportAsciiDlg_Impl::SaveParameters()
BitmapEx AbstractScImportAsciiDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -323,8 +320,7 @@ bool AbstractScColRowLabelDlg_Impl::IsRow()
BitmapEx AbstractScColRowLabelDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -340,8 +336,7 @@ void AbstractScDataPilotDatabaseDlg_Impl::GetValues( ScImportSourceDesc& rDesc )
BitmapEx AbstractScDataPilotDatabaseDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -377,8 +372,7 @@ void AbstractScDataPilotSourceTypeDlg_Impl::AppendNamedRange(const OUString& rNa
BitmapEx AbstractScDataPilotSourceTypeDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -419,8 +413,7 @@ DelCellCmd AbstractScDeleteCellDlg_Impl::GetDelCellCmd() const
BitmapEx AbstractScDeleteCellDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -441,8 +434,7 @@ InsertDeleteFlags AbstractScDeleteContentsDlg_Impl::GetDelContentsCmdBits() cons
BitmapEx AbstractScDeleteContentsDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -553,8 +545,7 @@ InsCellCmd AbstractScInsertContentsDlg_Impl::GetMoveMode()
BitmapEx AbstractScInsertContentsDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -600,8 +591,7 @@ const OUString* AbstractScInsertTableDlg_Impl::GetNextTable( sal_uInt16* pN )
BitmapEx AbstractScInsertTableDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -714,8 +704,7 @@ CreateNameFlags AbstractScNameCreateDlg_Impl::GetFlags() const
BitmapEx AbstractScNameCreateDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -820,8 +809,7 @@ OUString AbstractScStringInputDlg_Impl::GetInputString() const
BitmapEx AbstractScStringInputDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -837,8 +825,7 @@ void AbstractScTabBgColorDlg_Impl::GetSelectedColor( Color& rColor ) const
BitmapEx AbstractScTabBgColorDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -869,8 +856,7 @@ bool AbstractScTextImportOptionsDlg_Impl::IsDateConversionSet() const
BitmapEx AbstractScTextImportOptionsDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
+18 -36
View File
@@ -57,8 +57,7 @@ short SdAbstractGenericDialog_Impl::Execute()
BitmapEx SdAbstractGenericDialog_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -164,8 +163,7 @@ bool AbstractHeaderFooterDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
BitmapEx AbstractHeaderFooterDialog_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -196,8 +194,7 @@ short AbstractBreakDlg_Impl::Execute()
BitmapEx AbstractBreakDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -218,8 +215,7 @@ short AbstractMasterLayoutDialog_Impl::Execute()
BitmapEx AbstractMasterLayoutDialog_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -235,8 +231,7 @@ void AbstractCopyDlg_Impl::GetAttr( SfxItemSet& rOutAttrs )
BitmapEx AbstractCopyDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -257,8 +252,7 @@ bool AbstractSdCustomShowDlg_Impl::IsCustomShow() const
BitmapEx AbstractSdCustomShowDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -305,8 +299,7 @@ void SdAbstractTabController_Impl::SetText( const OUString& rStr )
BitmapEx SdAbstractTabController_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -342,8 +335,7 @@ void AbstractBulletDialog_Impl::SetText( const OUString& rStr )
BitmapEx AbstractBulletDialog_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -379,8 +371,7 @@ void SdPresLayoutTemplateDlg_Impl::SetText( const OUString& rStr )
BitmapEx SdPresLayoutTemplateDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -401,8 +392,7 @@ SfxItemSet AbstractSdModifyFieldDlg_Impl::GetItemSet()
BitmapEx AbstractSdModifyFieldDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -438,8 +428,7 @@ void AbstractSdSnapLineDlg_Impl::SetText( const OUString& rStr )
BitmapEx AbstractSdSnapLineDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -460,8 +449,7 @@ void AbstractSdInsertLayerDlg_Impl::SetHelpId( const OString& rHelpId )
BitmapEx AbstractSdInsertLayerDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -487,8 +475,7 @@ bool AbstractSdInsertPagesObjsDlg_Impl::IsRemoveUnnessesaryMasterPages() const
BitmapEx AbstractSdInsertPagesObjsDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -519,8 +506,7 @@ bool AbstractMorphDlg_Impl::IsOrientationFade() const
BitmapEx AbstractMorphDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -536,8 +522,7 @@ void AbstractSdStartPresDlg_Impl::GetAttr( SfxItemSet& rOutAttrs )
BitmapEx AbstractSdStartPresDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -553,8 +538,7 @@ void AbstractSdPresLayoutDlg_Impl::GetAttr( SfxItemSet& rOutAttrs )
BitmapEx AbstractSdPresLayoutDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -580,8 +564,7 @@ const GDIMetaFile& AbstractSdVectorizeDlg_Impl::GetGDIMetaFile() const
BitmapEx AbstractSdVectorizeDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
@@ -597,8 +580,7 @@ void AbstractSdPublishingDlg_Impl::GetParameterSequence( css::uno::Sequence< css
BitmapEx AbstractSdPublishingDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDlg->getDialog()->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
+1 -2
View File
@@ -1153,8 +1153,7 @@ BitmapEx SfxTabDialogController::createScreenshot() const
const_cast<SfxTabDialogController*>(this)->Start_Impl();
}
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
m_xDialog->draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(m_xDialog->screenshot());
return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
}
+1 -2
View File
@@ -112,8 +112,7 @@ void ScreenshotTest::saveScreenshot(VclAbstractDialog const & rDialog)
void ScreenshotTest::saveScreenshot(weld::Window& rDialog)
{
VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
rDialog.draw(*xDialogSurface);
VclPtr<VirtualDevice> xDialogSurface(rDialog.screenshot());
const BitmapEx aScreenshot(xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel()));
if (!aScreenshot.IsEmpty())
+3 -3
View File
@@ -387,7 +387,7 @@ public:
virtual void set_highlight_background() override;
virtual void draw(VirtualDevice& rOutput) override;
virtual void draw(OutputDevice& rOutput, const tools::Rectangle& rRect) override;
SystemWindow* getSystemWindow();
};
@@ -486,10 +486,10 @@ public:
virtual void HandleEventListener(VclWindowEvent& rEvent) override;
virtual void draw(VirtualDevice& rOutput) override;
virtual weld::ScreenShotCollection collect_screenshot_data() override;
virtual VclPtr<VirtualDevice> screenshot() override;
virtual ~SalInstanceWindow() override;
};
+7 -5
View File
@@ -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()
+8 -4
View File
@@ -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)
+28 -12
View File
@@ -3038,7 +3038,7 @@ public:
return xRet;
}
virtual void draw(VirtualDevice& rOutput) override
virtual void draw(OutputDevice& rOutput, const tools::Rectangle& rRect) override
{
// detect if we have to manually setup its size
bool bAlreadyRealized = gtk_widget_get_realized(m_pWidget);
@@ -3046,30 +3046,43 @@ public:
bool bAlreadyVisible = gtk_widget_get_visible(m_pWidget);
// has to be mapped for draw to work
bool bAlreadyMapped = gtk_widget_get_mapped(m_pWidget);
if (!bAlreadyVisible)
gtk_widget_show(m_pWidget);
GtkAllocation allocation;
if (!bAlreadyRealized)
gtk_widget_realize(m_pWidget);
if (!bAlreadyMapped)
gtk_widget_map(m_pWidget);
assert(gtk_widget_is_drawable(m_pWidget)); // all that should result in this holding
Size aSize(rRect.GetSize());
GtkAllocation aOrigAllocation;
gtk_widget_get_allocation(m_pWidget, &aOrigAllocation);
GtkAllocation aNewAllocation {aOrigAllocation.x,
aOrigAllocation.y,
static_cast<int>(aSize.Width()),
static_cast<int>(aSize.Height()) };
gtk_widget_set_allocation(m_pWidget, &aNewAllocation);
if (GTK_IS_CONTAINER(m_pWidget))
gtk_container_resize_children(GTK_CONTAINER(m_pWidget));
gtk_widget_get_allocation(m_pWidget, &allocation);
rOutput.SetOutputSizePixel(Size(allocation.width, allocation.height));
cairo_surface_t* pSurface = get_underlying_cairo_surface(rOutput);
VclPtr<VirtualDevice> xOutput(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
xOutput->SetOutputSizePixel(aSize);
cairo_surface_t* pSurface = get_underlying_cairo_surface(*xOutput);
cairo_t* cr = cairo_create(pSurface);
gtk_widget_draw(m_pWidget, cr);
cairo_destroy(cr);
gtk_widget_set_allocation(m_pWidget, &aOrigAllocation);
rOutput.DrawOutDev(rRect.TopLeft(), aSize, Point(), aSize, *xOutput);
if (!bAlreadyVisible)
gtk_widget_hide(m_pWidget);
if (!bAlreadyMapped)
@@ -4066,7 +4079,7 @@ public:
g_signal_handler_unblock(m_pWidget, m_nToplevelFocusChangedSignalId);
}
virtual void draw(VirtualDevice& rOutput) override
virtual VclPtr<VirtualDevice> screenshot() override
{
// detect if we have to manually setup its size
bool bAlreadyRealized = gtk_widget_get_realized(GTK_WIDGET(m_pWindow));
@@ -4087,8 +4100,9 @@ public:
gtk_widget_size_allocate(GTK_WIDGET(m_pWindow), &allocation);
}
rOutput.SetOutputSizePixel(get_size());
cairo_surface_t* pSurface = get_underlying_cairo_surface(rOutput);
VclPtr<VirtualDevice> xOutput(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
xOutput->SetOutputSizePixel(get_size());
cairo_surface_t* pSurface = get_underlying_cairo_surface(*xOutput);
cairo_t* cr = cairo_create(pSurface);
Point aOffset = get_csd_offset(GTK_WIDGET(m_pWindow));
@@ -4109,6 +4123,8 @@ public:
gtk_widget_hide(GTK_WIDGET(m_pWindow));
if (!bAlreadyRealized)
gtk_widget_unrealize(GTK_WIDGET(m_pWindow));
return xOutput;
}
virtual weld::ScreenShotCollection collect_screenshot_data() override