[Libreoffice-commits] core.git: vcl/inc vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 30 10:07:31 UTC 2020
vcl/inc/salgdi.hxx | 15 +++++++++++----
vcl/source/gdi/salgdilayout.cxx | 26 +++++++++++++++++++-------
vcl/source/gdi/virdev.cxx | 4 +++-
vcl/source/outdev/bitmap.cxx | 4 +++-
vcl/source/outdev/outdev.cxx | 11 +++++++----
vcl/source/window/window.cxx | 5 ++++-
6 files changed, 47 insertions(+), 18 deletions(-)
New commits:
commit 94c7afc66f8baaa140d36b4d7df47bae77b03284
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Nov 28 20:09:46 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Nov 30 11:06:51 2020 +0100
split CopyBits into two functions
to capture that if pSrcGraphics is non-null then pSrcOutDev is
always non-null and that if pSrcGraphics is null then pSrcOutDev is
unused
Change-Id: I7b1ecb35724ef9a7afb4ab4021b33e9f00a9ea3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106808
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 89951dc116cf..af2173b80daf 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -286,13 +286,20 @@ public:
tools::Long nSrcWidth, tools::Long nSrcHeight,
const OutputDevice& rOutDev );
- // CopyBits and DrawBitmap --> RasterOp and ClipRegion
- // CopyBits() --> pSrcGraphics == nullptr, then CopyBits on same Graphics
+ // CopyBits --> RasterOp and ClipRegion
+ // CopyBits() CopyBits on same Graphics
+ void CopyBits(
+ const SalTwoRect& rPosAry,
+ const OutputDevice& rOutDev);
+
+ // CopyBits --> RasterOp and ClipRegion
+ // CopyBits() CopyBits on different Graphics
void CopyBits(
const SalTwoRect& rPosAry,
- SalGraphics* pSrcGraphics,
+ SalGraphics& rSrcGraphics,
const OutputDevice& rOutDev,
- const OutputDevice *pSrcOutDev );
+ const OutputDevice& rSrcOutDev );
+
void DrawBitmap(
const SalTwoRect& rPosAry,
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 37cec5085015..3a9a4074a24b 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -620,21 +620,33 @@ void SalGraphics::CopyArea( tools::Long nDestX, tools::Long nDestY,
copyArea( nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, true/*bWindowInvalidate*/ );
}
-void SalGraphics::CopyBits( const SalTwoRect& rPosAry,
- SalGraphics* pSrcGraphics, const OutputDevice& rOutDev, const OutputDevice *pSrcOutDev )
+void SalGraphics::CopyBits(const SalTwoRect& rPosAry, const OutputDevice& rOutDev)
+{
+ if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
+ {
+ SalTwoRect aPosAry2 = rPosAry;
+ mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, &rOutDev );
+ copyBits( aPosAry2, nullptr );
+ }
+ else
+ copyBits( rPosAry, nullptr );
+}
+
+void SalGraphics::CopyBits(const SalTwoRect& rPosAry, SalGraphics& rSrcGraphics,
+ const OutputDevice& rOutDev, const OutputDevice& rSrcOutDev)
{
if( ( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() ) ||
- (pSrcGraphics && ( (pSrcGraphics->GetLayout() & SalLayoutFlags::BiDiRtl) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) ) )
+ ( (rSrcGraphics.GetLayout() & SalLayoutFlags::BiDiRtl) || rSrcOutDev.IsRTLEnabled()) )
{
SalTwoRect aPosAry2 = rPosAry;
- if( (pSrcGraphics && (pSrcGraphics->GetLayout() & SalLayoutFlags::BiDiRtl)) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) )
- mirror( aPosAry2.mnSrcX, aPosAry2.mnSrcWidth, pSrcOutDev );
+ if( (rSrcGraphics.GetLayout() & SalLayoutFlags::BiDiRtl) || rSrcOutDev.IsRTLEnabled() )
+ mirror( aPosAry2.mnSrcX, aPosAry2.mnSrcWidth, &rSrcOutDev );
if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, &rOutDev );
- copyBits( aPosAry2, pSrcGraphics );
+ copyBits( aPosAry2, &rSrcGraphics );
}
else
- copyBits( rPosAry, pSrcGraphics );
+ copyBits( rPosAry, &rSrcGraphics );
}
void SalGraphics::DrawBitmap( const SalTwoRect& rPosAry,
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 3ae5b8c783b5..3d63cf90cd41 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -294,6 +294,8 @@ bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bEra
if ( !mpGraphics && !AcquireGraphics() )
return false;
+ assert(mpGraphics);
+
pNewVirDev = pSVData->mpDefInst->CreateVirtualDevice(mpGraphics, nNewWidth, nNewHeight, meFormat);
if ( pNewVirDev )
{
@@ -311,7 +313,7 @@ bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bEra
else
nHeight = nNewHeight;
SalTwoRect aPosAry(0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight);
- pGraphics->CopyBits( aPosAry, mpGraphics, *this, this );
+ pGraphics->CopyBits( aPosAry, *mpGraphics, *this, *this );
pNewVirDev->ReleaseGraphics( pGraphics );
ReleaseGraphics();
mpVirDev = std::move(pNewVirDev);
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 1efe45e5ea92..9ed95ddf748a 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -390,6 +390,8 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
if ( mpGraphics || AcquireGraphics() )
{
+ assert(mpGraphics);
+
if ( nWidth > 0 && nHeight > 0 && nX <= (mnOutWidth + mnOutOffX) && nY <= (mnOutHeight + mnOutOffY))
{
tools::Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
@@ -442,7 +444,7 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
(aRect.Left() < mnOutOffX) ? (mnOutOffX - aRect.Left()) : 0L,
(aRect.Top() < mnOutOffY) ? (mnOutOffY - aRect.Top()) : 0L,
nWidth, nHeight);
- aVDev->mpGraphics->CopyBits( aPosAry, mpGraphics, *this, this );
+ aVDev->mpGraphics->CopyBits(aPosAry, *mpGraphics, *this, *this);
}
else
{
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index c443044f7a99..063e9485d2e4 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -388,7 +388,7 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
AdjustTwoRect( aPosAry, aSrcOutRect );
if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
- mpGraphics->CopyBits( aPosAry, nullptr, *this, nullptr );
+ mpGraphics->CopyBits(aPosAry, *this);
}
if( mpAlphaVDev )
@@ -512,7 +512,7 @@ void OutputDevice::CopyDeviceArea( SalTwoRect& aPosAry, bool /*bWindowInvalidate
aPosAry.mnDestWidth = aPosAry.mnSrcWidth;
aPosAry.mnDestHeight = aPosAry.mnSrcHeight;
- mpGraphics->CopyBits(aPosAry, nullptr, *this, nullptr);
+ mpGraphics->CopyBits(aPosAry, *this);
}
// Direct OutputDevice drawing private function
@@ -558,10 +558,13 @@ void OutputDevice::DrawOutDevDirectProcess(const OutputDevice& rSrcDev, SalTwoRe
{
SalTwoRect aPosAry2 = rPosAry;
pSrcGraphics->mirror( aPosAry2.mnSrcX, aPosAry2.mnSrcWidth, &rSrcDev );
- mpGraphics->CopyBits( aPosAry2, pSrcGraphics, *this, &rSrcDev );
+ mpGraphics->CopyBits( aPosAry2, *pSrcGraphics, *this, rSrcDev );
+ return;
}
+ if (pSrcGraphics)
+ mpGraphics->CopyBits( rPosAry, *pSrcGraphics, *this, rSrcDev );
else
- mpGraphics->CopyBits( rPosAry, pSrcGraphics, *this, &rSrcDev );
+ mpGraphics->CopyBits( rPosAry, *this );
}
tools::Rectangle OutputDevice::GetBackgroundComponentBounds() const
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 7224dd138168..1fe5940c028f 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1265,7 +1265,10 @@ const OutputDevice* Window::DrawOutDevDirectCheck(const OutputDevice& rSrcDev) c
void Window::DrawOutDevDirectProcess( const OutputDevice& rSrcDev, SalTwoRect& rPosAry, SalGraphics* pSrcGraphics )
{
- mpGraphics->CopyBits( rPosAry, pSrcGraphics, *this, &rSrcDev );
+ if (pSrcGraphics)
+ mpGraphics->CopyBits(rPosAry, *pSrcGraphics, *this, rSrcDev);
+ else
+ mpGraphics->CopyBits(rPosAry, *this);
}
SalGraphics* Window::ImplGetFrameGraphics() const
More information about the Libreoffice-commits
mailing list