[Libreoffice-commits] core.git: include/vcl vcl/source
Yusuf Keten (via logerrit)
logerrit at kemper.freedesktop.org
Sat Feb 8 15:56:55 UTC 2020
include/vcl/outdev.hxx | 2 ++
include/vcl/print.hxx | 2 ++
vcl/source/gdi/print.cxx | 7 +++++++
vcl/source/gdi/print2.cxx | 11 +----------
vcl/source/outdev/outdev.cxx | 5 +++++
5 files changed, 17 insertions(+), 10 deletions(-)
New commits:
commit ec48d37f574924c66dea4f7adb56944bbe636aa1
Author: Yusuf Keten <ketenyusuf at gmail.com>
AuthorDate: Fri Feb 7 19:18:57 2020 +0300
Commit: Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Sat Feb 8 16:56:23 2020 +0100
tdf#74702 Remove OutDevType from OutputDevice::RemoveTransparenciesFromMetaFile
Extracted SetBackgroundComponentBounds() which removes need for
checking OutDevType especially whether it is Printer or not in OutputDevice.
Change-Id: Ib8884b861314f595283af9ae3a2cd5645b334d51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86312
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 687b9a1c207a..e4430b2415f3 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -559,6 +559,8 @@ protected:
virtual void CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate);
+ virtual tools::Rectangle SetBackgroundComponentBounds();
+
virtual void DrawOutDevDirectCheck( const OutputDevice* pSrcDev, SalGraphics*& pSrcGraphics );
virtual void DrawOutDevDirectProcess( const OutputDevice* pSrcDev, SalTwoRect& rPosAry, SalGraphics* pSrcGraphics );
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 154ee694bd83..eff9c983ff5c 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -365,6 +365,8 @@ public:
virtual void CopyArea( const Point& rDestPt, const Point& rSrcPt,
const Size& rSrcSize, bool bWindowInvalidate = false ) override;
+ virtual tools::Rectangle SetBackgroundComponentBounds() override;
+
// These 3 together are more modular PrintJob(), allowing printing more documents as one print job
// by repeated calls to ExecutePrintJob(). Used by mailmerge.
static bool PreparePrintJob( std::shared_ptr<vcl::PrinterController> i_pController,
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 364f0af35587..7c8a68892708 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -316,6 +316,13 @@ void Printer::CopyArea( const Point& /*rDestPt*/,
SAL_WARN( "vcl.gdi", "Don't use OutputDevice::CopyArea(...) with printer devices!" );
}
+tools::Rectangle Printer::SetBackgroundComponentBounds()
+{
+ Point aPageOffset = Point( 0, 0 ) - this->GetPageOffsetPixel();
+ Size aSize = this->GetPaperSizePixel();
+ return tools::Rectangle( aPageOffset, aSize );
+}
+
void Printer::SetPrinterOptions( const PrinterOptions& i_rOptions )
{
*mpPrinterOptions = i_rOptions;
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index db4b6dd0af72..b51318c8ea83 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -748,16 +748,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
if( rBackground != COL_TRANSPARENT )
{
aBackgroundComponent.aBgColor = rBackground;
- if( meOutDevType == OUTDEV_PRINTER )
- {
- Printer* pThis = dynamic_cast<Printer*>(this);
- assert(pThis);
- Point aPageOffset = Point( 0, 0 ) - pThis->GetPageOffsetPixel();
- Size aSize = pThis->GetPaperSizePixel();
- aBackgroundComponent.aBounds = tools::Rectangle( aPageOffset, aSize );
- }
- else
- aBackgroundComponent.aBounds = tools::Rectangle( Point( 0, 0 ), GetOutputSizePixel() );
+ aBackgroundComponent.aBounds = SetBackgroundComponentBounds();
}
while( pCurrAct && bStillBackground )
{
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 880181cb5407..0dcdd84a5d0a 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -579,6 +579,11 @@ void OutputDevice::DrawOutDevDirectProcess( const OutputDevice* pSrcDev, SalTwoR
mpGraphics->CopyBits( rPosAry, pSrcGraphics, this, pSrcDev );
}
+tools::Rectangle OutputDevice::SetBackgroundComponentBounds()
+{
+ return tools::Rectangle( Point( 0, 0 ), GetOutputSizePixel() );
+}
+
// Layout public functions
void OutputDevice::EnableRTL( bool bEnable )
More information about the Libreoffice-commits
mailing list