diff options
author | Yusuf Keten <ketenyusuf@gmail.com> | 2020-01-04 20:39:42 +0300 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@collabora.com> | 2020-02-04 18:05:28 +0100 |
commit | a68157c88add7a815678155f4d7a743b010d92f5 (patch) | |
tree | cd22f04c15dfd8b2a6ebc75b6c14ed6b8df575cc /vcl/source/outdev | |
parent | 5a989074cd1f8afdc03d0ee4f2dc12b174f9aa19 (diff) |
tdf#74702: Remove enum OutDevType from OutputDevice::drawOutDevDirect
Extracted DrawOutDevDirectCheck and DrawOutDevDirectProcess. DrawoutDevDirectCheck checks OutputDeviceType and define pSrcGraphics according to its type. DrawOutDevDirectProcess perform some operations about drawing out according to its type and checks some pointers for avoiding NULL pointer.
Change-Id: I24247ee42d2dd686dbd13bb5f6b24bbe8fab43ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86229
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
Diffstat (limited to 'vcl/source/outdev')
-rw-r--r-- | vcl/source/outdev/outdev.cxx | 68 |
1 files changed, 28 insertions, 40 deletions
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 6776cb3d7c85..880181cb5407 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -532,41 +532,9 @@ void OutputDevice::CopyDeviceArea( SalTwoRect& aPosAry, bool /*bWindowInvalidate void OutputDevice::drawOutDevDirect( const OutputDevice* pSrcDev, SalTwoRect& rPosAry ) { SalGraphics* pSrcGraphics; + SalGraphics*& pSrcGraphicsRef = pSrcGraphics; - if ( this == pSrcDev ) - pSrcGraphics = nullptr; - else - { - if ( (GetOutDevType() != pSrcDev->GetOutDevType()) || - (GetOutDevType() != OUTDEV_WINDOW) ) - { - if ( !pSrcDev->mpGraphics ) - { - if ( !pSrcDev->AcquireGraphics() ) - return; - } - pSrcGraphics = pSrcDev->mpGraphics; - } - else - { - if ( static_cast<vcl::Window*>(this)->mpWindowImpl->mpFrameWindow == static_cast<const vcl::Window*>(pSrcDev)->mpWindowImpl->mpFrameWindow ) - pSrcGraphics = nullptr; - else - { - if ( !pSrcDev->mpGraphics ) - { - if ( !pSrcDev->AcquireGraphics() ) - return; - } - pSrcGraphics = pSrcDev->mpGraphics; - - if ( !mpGraphics && !AcquireGraphics() ) - return; - SAL_WARN_IF( !mpGraphics || !pSrcDev->mpGraphics, "vcl.gdi", - "OutputDevice::DrawOutDev(): We need more than one Graphics" ); - } - } - } + DrawOutDevDirectCheck(pSrcDev, pSrcGraphicsRef); // #102532# Offset only has to be pseudo window offset const tools::Rectangle aSrcOutRect( Point( pSrcDev->mnOutOffX, pSrcDev->mnOutOffY ), @@ -580,17 +548,37 @@ void OutputDevice::drawOutDevDirect( const OutputDevice* pSrcDev, SalTwoRect& rP // mirroring may be required // because only windows have a SalGraphicsLayout // mirroring is performed here - if( (GetOutDevType() != OUTDEV_WINDOW) && pSrcGraphics && (pSrcGraphics->GetLayout() & SalLayoutFlags::BiDiRtl) ) + DrawOutDevDirectProcess( pSrcDev, rPosAry, pSrcGraphics); + } +} + +void OutputDevice::DrawOutDevDirectCheck( const OutputDevice* pSrcDev, SalGraphics*& pSrcGraphics ) +{ + if ( this == pSrcDev ) + pSrcGraphics = nullptr; + else + { + if ( !pSrcDev->mpGraphics ) { - SalTwoRect aPosAry2 = rPosAry; - pSrcGraphics->mirror( aPosAry2.mnSrcX, aPosAry2.mnSrcWidth, pSrcDev ); - mpGraphics->CopyBits( aPosAry2, pSrcGraphics, this, pSrcDev ); + if ( !pSrcDev->AcquireGraphics() ) + return; } - else - mpGraphics->CopyBits( rPosAry, pSrcGraphics, this, pSrcDev ); + pSrcGraphics = pSrcDev->mpGraphics; } } +void OutputDevice::DrawOutDevDirectProcess( const OutputDevice* pSrcDev, SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) +{ + if( pSrcGraphics && (pSrcGraphics->GetLayout() & SalLayoutFlags::BiDiRtl) ) + { + SalTwoRect aPosAry2 = rPosAry; + pSrcGraphics->mirror( aPosAry2.mnSrcX, aPosAry2.mnSrcWidth, pSrcDev ); + mpGraphics->CopyBits( aPosAry2, pSrcGraphics, this, pSrcDev ); + } + else + mpGraphics->CopyBits( rPosAry, pSrcGraphics, this, pSrcDev ); +} + // Layout public functions void OutputDevice::EnableRTL( bool bEnable ) |