fix incorrect palette color indexes
nSrcCount is obviously not supposed to be related to pDstAcc if
it's used to index pSrcAcc. And nNextIndex is used to index pDstAcc,
so it should be compared to nDstCount.
Change-Id: Icc47f316a8c376943c66d1ef6127a6f85c56b624
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112667
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index caf5891..ab83d18 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -579,10 +579,10 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst,
if( pSrcAcc && pDstAcc )
{
const int nSrcCount = pDstAcc->GetPaletteEntryCount();
const int nSrcCount = pSrcAcc->GetPaletteEntryCount();
const int nDstCount = 1 << nDstBitCount;
for (int i = 0; ( i < nSrcCount ) && ( nNextIndex < nSrcCount ); ++i)
for (int i = 0; ( i < nSrcCount ) && ( nNextIndex < nDstCount ); ++i)
{
const BitmapColor& rSrcCol = pSrcAcc->GetPaletteColor( static_cast<sal_uInt16>(i) );