summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-07-28 10:07:50 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-08-25 19:35:39 +0200
commitc2e7df1ce8ba50b2179904963e825315785585e4 (patch)
treee1fe1a6778533f0c3193a2bd61f6878cb8424fba
parent5e975f671bc37d837d66e712ea064809daf51288 (diff)
ofz#2766 ensure palette is large enough for all colors
Change-Id: I4669b473f5975ac74a37025f7c936f13bcfea420 Reviewed-on: https://gerrit.libreoffice.org/40511 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--filter/source/graphicfilter/itiff/itiff.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index f785ab5a7666..65db2efaa6d9 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -1128,7 +1128,6 @@ void TIFFReader::MakePalCol()
nNumColors = nLargestPixelIndex + 1;
}
- pAcc->SetPaletteEntryCount(nNumColors);
for (sal_uInt32 i = 0; i < nNumColors; ++i)
{
sal_uInt32 nVal = ( i * 255 / ( nNumColors - 1 ) ) & 0xff;
@@ -1139,6 +1138,7 @@ void TIFFReader::MakePalCol()
xColorMap[nNumColors - i - 1] = n0RGB;
}
}
+ pAcc->SetPaletteEntryCount(std::max<sal_uInt16>(nNumColors, pAcc->GetPaletteEntryCount()));
for (sal_uInt32 i = 0; i < nNumColors; ++i)
{
pAcc->SetPaletteColor(i, BitmapColor( (sal_uInt8)( xColorMap[ i ] >> 16 ),