summaryrefslogtreecommitdiff
path: root/vcl/source/filter/itiff/itiff.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/filter/itiff/itiff.cxx')
-rw-r--r--vcl/source/filter/itiff/itiff.cxx37
1 files changed, 9 insertions, 28 deletions
diff --git a/vcl/source/filter/itiff/itiff.cxx b/vcl/source/filter/itiff/itiff.cxx
index ae797aa978a5..5ce017dea9c7 100644
--- a/vcl/source/filter/itiff/itiff.cxx
+++ b/vcl/source/filter/itiff/itiff.cxx
@@ -902,7 +902,10 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
}
}
}
- else if ( nPhotometricInterpretation == 2 && nSamplesPerPixel >= 3 )
+ else if (
+ ( nPhotometricInterpretation == 2 && nSamplesPerPixel >= 3 ) ||
+ ( nPhotometricInterpretation == 5 && nSamplesPerPixel == 3 )
+ )
{
if ( nMaxSampleValue > nMinSampleValue )
{
@@ -912,29 +915,6 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
if ( nPlanes < 3 )
{
nRed = GetBits( getMapData(0), ( nx * nSamplesPerPixel + 0 ) * nBitsPerSample, nBitsPerSample );
- nGreen = GetBits( getMapData(1), ( nx * nSamplesPerPixel + 1 ) * nBitsPerSample, nBitsPerSample );
- nBlue = GetBits( getMapData(2), ( nx * nSamplesPerPixel + 2 ) * nBitsPerSample, nBitsPerSample );
- }
- else
- {
- nRed = GetBits( getMapData(0), nx * nBitsPerSample, nBitsPerSample );
- nGreen = GetBits( getMapData(1), nx * nBitsPerSample, nBitsPerSample );
- nBlue = GetBits( getMapData(2), nx * nBitsPerSample, nBitsPerSample );
- }
- SetPixel(nY, nx, Color(static_cast<sal_uInt8>(nRed - nMinMax), static_cast<sal_uInt8>(nGreen - nMinMax), static_cast<sal_uInt8>(nBlue - nMinMax)));
- }
- }
- }
- else if ( nPhotometricInterpretation == 5 && nSamplesPerPixel == 3 )
- {
- if ( nMaxSampleValue > nMinSampleValue )
- {
- sal_uInt32 nMinMax = nMinSampleValue * 255 / ( nMaxSampleValue - nMinSampleValue );
- for (sal_Int32 nx = 0; nx < nImageWidth; ++nx)
- {
- if ( nPlanes < 3 )
- {
- nRed = GetBits( getMapData(0), ( nx * nSamplesPerPixel + 0 ) * nBitsPerSample, nBitsPerSample );
nGreen = GetBits( getMapData(0), ( nx * nSamplesPerPixel + 1 ) * nBitsPerSample, nBitsPerSample );
nBlue = GetBits( getMapData(0), ( nx * nSamplesPerPixel + 2 ) * nBitsPerSample, nBitsPerSample );
}
@@ -944,10 +924,10 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
nGreen = GetBits( getMapData(1), nx * nBitsPerSample, nBitsPerSample );
nBlue = GetBits( getMapData(2), nx * nBitsPerSample, nBitsPerSample );
}
- nRed = 255 - static_cast<sal_uInt8>( nRed - nMinMax );
- nGreen = 255 - static_cast<sal_uInt8>( nGreen - nMinMax );
- nBlue = 255 - static_cast<sal_uInt8>( nBlue - nMinMax );
- SetPixel(nY, nx, Color(static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue)));
+ if (nPhotometricInterpretation == 2)
+ SetPixel(nY, nx, Color(static_cast<sal_uInt8>(nRed - nMinMax), static_cast<sal_uInt8>(nGreen - nMinMax), static_cast<sal_uInt8>(nBlue - nMinMax)));
+ else
+ SetPixel(nY, nx, Color(255 - static_cast<sal_uInt8>(nRed - nMinMax), 255 - static_cast<sal_uInt8>(nGreen - nMinMax), 255 - static_cast<sal_uInt8>(nBlue - nMinMax)));
}
}
}
@@ -1140,6 +1120,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
while ( nx < nImageWidth )
{
SetPixel(nY, nx++, ( nByteVal >> nShift ) & 1);
+ --nShift;
}
}
}