diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-23 14:01:24 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-24 14:42:26 +0200 |
commit | 6217cfd414ee86b160313c0a71b7d62e1eb3db14 (patch) | |
tree | 1471e49de2c68a0cc4d0f42bfb37dc8bffb883bf /vcl/source/gdi/salgdilayout.cxx | |
parent | a27d9845935149005342c74736a961068e6bf242 (diff) |
Introduce OutputDevice type OUTDEV_PDF
Originally I thought mpPDFWriter can be used to create PDF from
any OutputDevice, but it's actually just set for the internal
VirtualDevice of the PDF writer.
So this gets rid of all the special mpPDFWriter and GetPDFWriter()
handling and replaces it with checks for OUTDEV_PDF. But since
ImplPDFWriter used to be a OUTDEV_VIRDEV, this also introduces
OutputDevice::IsVirtual(), which now replaces most of the direct
OUTDEV_VIRDEV checks.
Change-Id: I11824143b6b8833ecc81119762448cbdf1145dbc
Reviewed-on: https://gerrit.libreoffice.org/62257
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/source/gdi/salgdilayout.cxx')
-rw-r--r-- | vcl/source/gdi/salgdilayout.cxx | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index d28c751f42a9..2bb5b47d3b80 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -118,14 +118,15 @@ long SalGraphics::mirror2( long x, const OutputDevice *pOutDev ) const return x; } -void SalGraphics::mirror( long& x, const OutputDevice *pOutDev ) const +inline long SalGraphics::GetDeviceWidth(const OutputDevice* pOutDev) const { - long w; - if( pOutDev && pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) - w = pOutDev->GetOutputWidthPixel(); - else - w = GetGraphicsWidth(); + return (pOutDev && pOutDev->IsVirtual()) + ? pOutDev->GetOutputWidthPixel() : GetGraphicsWidth(); +} +void SalGraphics::mirror( long& x, const OutputDevice *pOutDev ) const +{ + const long w = GetDeviceWidth(pOutDev); if( w ) { if( pOutDev && pOutDev->ImplIsAntiparallel() ) @@ -150,12 +151,7 @@ void SalGraphics::mirror( long& x, const OutputDevice *pOutDev ) const void SalGraphics::mirror( long& x, long nWidth, const OutputDevice *pOutDev, bool bBack ) const { - long w; - if( pOutDev && pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) - w = pOutDev->GetOutputWidthPixel(); - else - w = GetGraphicsWidth(); - + const long w = GetDeviceWidth(pOutDev); if( w ) { if( pOutDev && pOutDev->ImplIsAntiparallel() ) @@ -181,18 +177,12 @@ void SalGraphics::mirror( long& x, long nWidth, const OutputDevice *pOutDev, boo } else if( m_nLayout & SalLayoutFlags::BiDiRtl ) x = w-nWidth-x; - } } bool SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint *pPtAry2, const OutputDevice *pOutDev ) const { - long w; - if( pOutDev && pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) - w = pOutDev->GetOutputWidthPixel(); - else - w = GetGraphicsWidth(); - + const long w = GetDeviceWidth(pOutDev); if( w ) { sal_uInt32 i, j; @@ -315,9 +305,7 @@ basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rP const basegfx::B2DHomMatrix& SalGraphics::getMirror( const OutputDevice* i_pOutDev ) const { // get mirroring transformation - const long w(nullptr != i_pOutDev && OUTDEV_VIRDEV == i_pOutDev->GetOutDevType() - ? i_pOutDev->GetOutputWidthPixel() - : GetGraphicsWidth()); + const long w = GetDeviceWidth(i_pOutDev); SAL_WARN_IF( !w, "vcl", "missing graphics width" ); if(w != m_aLastMirrorW) |