vcl/inc/svimpbox.hxx | 2 - vcl/source/bitmap/dibtools.cxx | 45 ++++++++++++----------------------- vcl/source/treelist/iconviewimpl.cxx | 7 +---- vcl/source/treelist/iconviewimpl.hxx | 2 - vcl/source/treelist/svimpbox.cxx | 11 +++----- 5 files changed, 24 insertions(+), 43 deletions(-)
New commits: commit 23583706b51f4c1cde8ceb20557fe376691fad88 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Jul 4 20:27:38 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jul 5 09:33:41 2023 +0200 loplugin:constantparam Change-Id: Ib7bba815fcd4d2d4092bdd96055517468f6c6b09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153983 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vcl/inc/svimpbox.hxx b/vcl/inc/svimpbox.hxx index 949a488ed816..61e103e12b1f 100644 --- a/vcl/inc/svimpbox.hxx +++ b/vcl/inc/svimpbox.hxx @@ -250,7 +250,7 @@ public: void Resize(); void GetFocus(); void LoseFocus(); - virtual void UpdateAll( bool bInvalidateCompleteView ); + virtual void UpdateAll(); void SetEntryHeight(); void InvalidateEntry( SvTreeListEntry* ); void RecalcFocusRect(); diff --git a/vcl/source/bitmap/dibtools.cxx b/vcl/source/bitmap/dibtools.cxx index c95c21704dd9..d8fa61362635 100644 --- a/vcl/source/bitmap/dibtools.cxx +++ b/vcl/source/bitmap/dibtools.cxx @@ -330,7 +330,7 @@ bool ImplReadDIBPalette(SvStream& rIStm, BitmapPalette& rPal, bool bQuad) return rIStm.GetError() == ERRCODE_NONE; } -BitmapColor SanitizePaletteIndex(sal_uInt8 nIndex, BitmapPalette& rPalette, bool bForceToMonoWhileReading) +BitmapColor SanitizePaletteIndex(sal_uInt8 nIndex, BitmapPalette& rPalette) { const sal_uInt16 nPaletteEntryCount = rPalette.GetEntryCount(); if (nPaletteEntryCount && nIndex >= nPaletteEntryCount) @@ -341,22 +341,9 @@ BitmapColor SanitizePaletteIndex(sal_uInt8 nIndex, BitmapPalette& rPalette, bool << nPaletteEntryCount); nIndex = nSanitizedIndex; } - - if (nPaletteEntryCount && bForceToMonoWhileReading) - { - return BitmapColor(static_cast<sal_uInt8>(rPalette[nIndex].GetLuminance() >= 255)); - } - return BitmapColor(nIndex); } -BitmapColor SanitizeColor(const BitmapColor &rColor, bool bForceToMonoWhileReading) -{ - if (!bForceToMonoWhileReading) - return rColor; - return BitmapColor(static_cast<sal_uInt8>(rColor.GetLuminance() >= 255)); -} - bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & rHeader, BitmapWriteAccess& rAcc, BitmapPalette& rPalette, bool bRLE4) { Scanline pRLE = pBuffer; @@ -394,10 +381,10 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & rHeader, BitmapWriteA cTmp = *pRLE++; if( nX < nWidth ) - rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp >> 4, rPalette, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp >> 4, rPalette)); if( nX < nWidth ) - rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp & 0x0f, rPalette, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp & 0x0f, rPalette)); } if( nRunByte & 1 ) @@ -406,7 +393,7 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & rHeader, BitmapWriteA return false; if( nX < nWidth ) - rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(*pRLE >> 4, rPalette, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(*pRLE >> 4, rPalette)); pRLE++; } @@ -427,7 +414,7 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & rHeader, BitmapWriteA return false; if( nX < nWidth ) - rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(*pRLE, rPalette, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(*pRLE, rPalette)); pRLE++; } @@ -474,18 +461,18 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & rHeader, BitmapWriteA for (sal_uLong i = 0; i < nRunByte && nX < nWidth; ++i) { - rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp >> 4, rPalette, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp >> 4, rPalette)); if( nX < nWidth ) - rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp & 0x0f, rPalette, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp & 0x0f, rPalette)); } if( ( nCountByte & 1 ) && ( nX < nWidth ) ) - rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp >> 4, rPalette, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp >> 4, rPalette)); } else { for (sal_uLong i = 0; i < nCountByte && nX < nWidth; ++i) - rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp, rPalette, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX++, SanitizePaletteIndex(cTmp, rPalette)); } } } @@ -605,7 +592,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r } auto nIndex = (cTmp >> --nShift) & 1; - rAcc.SetPixelOnData(pScanline, nX, SanitizePaletteIndex(nIndex, rPalette, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX, SanitizePaletteIndex(nIndex, rPalette)); } } } @@ -632,7 +619,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r } auto nIndex = (cTmp >> ( --nShift << 2 ) ) & 0x0f; - rAcc.SetPixelOnData(pScanline, nX, SanitizePaletteIndex(nIndex, rPalette, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX, SanitizePaletteIndex(nIndex, rPalette)); } } } @@ -653,7 +640,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r for( tools::Long nX = 0; nX < nWidth; nX++ ) { auto nIndex = *pTmp++; - rAcc.SetPixelOnData(pScanline, nX, SanitizePaletteIndex(nIndex, rPalette, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX, SanitizePaletteIndex(nIndex, rPalette)); } } } @@ -687,7 +674,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r for( tools::Long nX = 0; nX < nWidth; nX++ ) { aMask.GetColorFor16BitLSB( aColor, reinterpret_cast<sal_uInt8*>(pTmp16++) ); - rAcc.SetPixelOnData(pScanline, nX, SanitizeColor(aColor, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX, aColor); } } } @@ -712,7 +699,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r aPixelColor.SetBlue( *pTmp++ ); aPixelColor.SetGreen( *pTmp++ ); aPixelColor.SetRed( *pTmp++ ); - rAcc.SetPixelOnData(pScanline, nX, SanitizeColor(aPixelColor, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX, aPixelColor); } } } @@ -752,7 +739,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r for( tools::Long nX = 0; nX < nWidth; nX++ ) { aMask.GetColorAndAlphaFor32Bit( aColor, aAlpha, reinterpret_cast<sal_uInt8*>(pTmp32++) ); - rAcc.SetPixelOnData(pScanline, nX, SanitizeColor(aColor, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX, aColor); pAccAlpha->SetPixelOnData(pAlphaScanline, nX, BitmapColor(sal_uInt8(0xff) - aAlpha)); rAlphaUsed |= 0xff != aAlpha; } @@ -773,7 +760,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r for( tools::Long nX = 0; nX < nWidth; nX++ ) { aMask.GetColorFor32Bit( aColor, reinterpret_cast<sal_uInt8*>(pTmp32++) ); - rAcc.SetPixelOnData(pScanline, nX, SanitizeColor(aColor, /*bForceToMonoWhileReading*/false)); + rAcc.SetPixelOnData(pScanline, nX, aColor); } } } diff --git a/vcl/source/treelist/iconviewimpl.cxx b/vcl/source/treelist/iconviewimpl.cxx index 6839ff1db5da..048e193d4f4b 100644 --- a/vcl/source/treelist/iconviewimpl.cxx +++ b/vcl/source/treelist/iconviewimpl.cxx @@ -464,7 +464,7 @@ void IconViewImpl::SyncVerThumb() m_aVerSBar->SetThumbPos(GetEntryRow(m_pStartEntry)); } -void IconViewImpl::UpdateAll( bool bInvalidateCompleteView ) +void IconViewImpl::UpdateAll() { FindMostRight(); SyncVerThumb(); @@ -473,10 +473,7 @@ void IconViewImpl::UpdateAll( bool bInvalidateCompleteView ) if( m_bSimpleTravel && m_pCursor && m_pView->HasFocus() ) m_pView->Select( m_pCursor ); ShowCursor( true ); - if( bInvalidateCompleteView ) - m_pView->Invalidate(); - else - m_pView->Invalidate( GetVisibleArea() ); + m_pView->Invalidate( GetVisibleArea() ); } void IconViewImpl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) diff --git a/vcl/source/treelist/iconviewimpl.hxx b/vcl/source/treelist/iconviewimpl.hxx index c265ae5a2a31..d566e338bb02 100644 --- a/vcl/source/treelist/iconviewimpl.hxx +++ b/vcl/source/treelist/iconviewimpl.hxx @@ -44,7 +44,7 @@ public: // returns 0 if position is just past the last entry SvTreeListEntry* GetEntry(const Point& rPoint) const override; - void UpdateAll(bool bInvalidateCompleteView) override; + void UpdateAll() override; bool KeyInput(const KeyEvent&) override; diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index c61fec0f001a..f0fa1938a8a9 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -667,7 +667,7 @@ void SvImpLBox::ShowCursor( bool bShow ) } -void SvImpLBox::UpdateAll( bool bInvalidateCompleteView ) +void SvImpLBox::UpdateAll() { FindMostRight(); m_aVerSBar->SetRange( Range(0, m_pView->GetVisibleCount()-1 ) ); @@ -677,10 +677,7 @@ void SvImpLBox::UpdateAll( bool bInvalidateCompleteView ) if( m_bSimpleTravel && m_pCursor && m_pView->HasFocus() ) m_pView->Select( m_pCursor ); ShowCursor( true ); - if( bInvalidateCompleteView ) - m_pView->Invalidate(); - else - m_pView->Invalidate( GetVisibleArea() ); + m_pView->Invalidate( GetVisibleArea() ); } IMPL_LINK( SvImpLBox, ScrollLeftRightHdl, ScrollBar *, pScrollBar, void ) @@ -1238,7 +1235,7 @@ void SvImpLBox::Resize() if( m_pView->GetEntryHeight()) { AdjustScrollBars( m_aOutputSize ); - UpdateAll(false); + UpdateAll(); } // HACK, as in floating and docked windows the scrollbars might not be drawn // correctly/not be drawn at all after resizing! @@ -2975,7 +2972,7 @@ void SvImpLBox::SetUpdateMode( bool bMode ) { m_bUpdateMode = bMode; if( m_bUpdateMode ) - UpdateAll( false ); + UpdateAll(); } }