summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorYusuf Keten <ketenyusuf@gmail.com>2020-02-07 19:18:57 +0300
committerMuhammet Kara <muhammet.kara@collabora.com>2020-02-08 16:56:23 +0100
commitec48d37f574924c66dea4f7adb56944bbe636aa1 (patch)
treeb00071b6c8ed27324f455afef42f8ea3bb8cafba /vcl/source
parent85dc497f1556ebc53f482e382f48e98b9560b983 (diff)
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@collabora.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/print.cxx7
-rw-r--r--vcl/source/gdi/print2.cxx11
-rw-r--r--vcl/source/outdev/outdev.cxx5
3 files changed, 13 insertions, 10 deletions
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 )