ofz: speed up bitmap image fuzzing
Change-Id: I73c9ee7aef7062e3cb025c6ae0f3bb6a91485330 Reviewed-on: https://gerrit.libreoffice.org/48983 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -182,10 +182,11 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe
|
||||
for( int y = 0; y < nHeight; ++y )
|
||||
{
|
||||
sal_uInt8 *p = pData + y * nStride;
|
||||
for( int x = 0; x < nWidth; ++x )
|
||||
Scanline pScanline = pWrite->GetScanline(y);
|
||||
for (int x = 0; x < nWidth; ++x)
|
||||
{
|
||||
BitmapColor col( p[0], p[1], p[2] );
|
||||
pWrite->SetPixel( y, x, col );
|
||||
BitmapColor col(p[0], p[1], p[2]);
|
||||
pWrite->SetPixelOnData(pScanline, x, col);
|
||||
p += 3;
|
||||
}
|
||||
}
|
||||
|
@@ -94,9 +94,10 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
|
||||
for ( ny = 0; --nyCount ; ny++, rDesc.mpBuf += rDesc.mnScanSize )
|
||||
{
|
||||
nxC = nxCount;
|
||||
Scanline pScanline = rDesc.mpAcc->GetScanline(ny);
|
||||
for ( nx = 0; --nxC; nx++ )
|
||||
{ // this is not fast, but a one bit/pixel format is rarely used
|
||||
rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>( (*( rDesc.mpBuf + (nx >> 3)) >> ((nx & 7)^7))) & 1 );
|
||||
rDesc.mpAcc->SetPixelOnData(pScanline, nx, BitmapColor(static_cast<sal_uInt8>( (*( rDesc.mpBuf + (nx >> 3)) >> ((nx & 7)^7))) & 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,9 +109,10 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
|
||||
for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize )
|
||||
{
|
||||
nxC = nxCount;
|
||||
Scanline pScanline = rDesc.mpAcc->GetScanline(ny);
|
||||
for ( nx = 0; --nxC; nx++ )
|
||||
{ // this is not fast, but a two bits/pixel format is rarely used
|
||||
rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>( (*(rDesc.mpBuf + (nx >> 2)) >> (((nx & 3)^3) << 1))) & 3 );
|
||||
rDesc.mpAcc->SetPixelOnData(pScanline, nx, BitmapColor(static_cast<sal_uInt8>( (*(rDesc.mpBuf + (nx >> 2)) >> (((nx & 3)^3) << 1))) & 3));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,11 +129,12 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
|
||||
for ( nx = 0; --nxC; nx++ )
|
||||
{
|
||||
nDat = *pTemp++;
|
||||
rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>(nDat >> 4) );
|
||||
Scanline pScanline = rDesc.mpAcc->GetScanline(ny);
|
||||
rDesc.mpAcc->SetPixelOnData(pScanline, nx, BitmapColor(static_cast<sal_uInt8>(nDat >> 4)));
|
||||
if ( --nxC )
|
||||
{
|
||||
nx ++;
|
||||
rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>(nDat & 15) );
|
||||
++nx;
|
||||
rDesc.mpAcc->SetPixelOnData(pScanline, nx, BitmapColor(static_cast<sal_uInt8>(nDat & 15)));
|
||||
}
|
||||
else
|
||||
break;
|
||||
@@ -146,10 +149,11 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
|
||||
for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize )
|
||||
{
|
||||
sal_uInt8* pTemp = rDesc.mpBuf;
|
||||
Scanline pScanline = rDesc.mpAcc->GetScanline(ny);
|
||||
nxC = nxCount;
|
||||
for ( nx = 0; --nxC; nx++ )
|
||||
{
|
||||
rDesc.mpAcc->SetPixelIndex( ny, nx, *(pTemp++) );
|
||||
rDesc.mpAcc->SetPixelOnData(pScanline, nx, BitmapColor(*(pTemp++)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,12 +166,13 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
|
||||
{
|
||||
sal_uInt8* pTemp = rDesc.mpBuf;
|
||||
nxC = nxCount;
|
||||
Scanline pScanline = rDesc.mpAcc->GetScanline(ny);
|
||||
for ( nx = 0; --nxC; nx++ )
|
||||
{
|
||||
aBitmapColor.SetRed( *pTemp++ );
|
||||
aBitmapColor.SetGreen( *pTemp++ );
|
||||
aBitmapColor.SetBlue( *pTemp++ );
|
||||
rDesc.mpAcc->SetPixel( ny, nx, aBitmapColor );
|
||||
rDesc.mpAcc->SetPixelOnData(pScanline, nx, aBitmapColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -238,8 +238,9 @@ private:
|
||||
void SetLineColor( const Color& rColor );
|
||||
void SetFillColor( const Color& rColor );
|
||||
|
||||
// OSNOLA: returns the text encoding which must be used for system id
|
||||
static rtl_TextEncoding GetTextEncoding (sal_uInt16 fId = 0xFFFF);
|
||||
// OSNOLA: returns the text encoding which must be used for system id
|
||||
static rtl_TextEncoding GetTextEncoding (sal_uInt16 fId = 0xFFFF);
|
||||
|
||||
public:
|
||||
|
||||
PictReader()
|
||||
@@ -258,46 +259,46 @@ public:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#define SETBYTE \
|
||||
switch ( nPixelSize ) \
|
||||
{ \
|
||||
case 1 : \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat >> 7 ); \
|
||||
if ( nx == nWidth ) break; \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat >> 6 ); \
|
||||
if ( nx == nWidth ) break; \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat >> 5 ); \
|
||||
if ( nx == nWidth ) break; \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat >> 4 ); \
|
||||
if ( nx == nWidth ) break; \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat >> 3 ); \
|
||||
if ( nx == nWidth ) break; \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat >> 2 ); \
|
||||
if ( nx == nWidth ) break; \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat >> 1 ); \
|
||||
if ( nx == nWidth ) break; \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat ); \
|
||||
break; \
|
||||
case 2 : \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat >> 6 ); \
|
||||
if ( nx == nWidth ) break; \
|
||||
pAcc->SetPixelIndex( ny, nx++, (nDat>>4)&3);\
|
||||
if ( nx == nWidth ) break; \
|
||||
pAcc->SetPixelIndex( ny, nx++, (nDat>>2)&3 );\
|
||||
if ( nx == nWidth ) break; \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat & 3); \
|
||||
break; \
|
||||
case 4 : \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat >> 4 ); \
|
||||
if ( nx == nWidth ) break; \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat ); \
|
||||
break; \
|
||||
case 8 : \
|
||||
pAcc->SetPixelIndex( ny, nx++, nDat ); \
|
||||
break; \
|
||||
static void SetByte(sal_uInt16& nx, Scanline pScanline, BitmapWriteAccess* pAcc, sal_uInt16 nPixelSize, sal_uInt8 nDat, sal_uInt16 nWidth)
|
||||
{
|
||||
switch (nPixelSize)
|
||||
{
|
||||
case 1:
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat >> 7));
|
||||
if ( nx == nWidth ) break;
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat >> 6));
|
||||
if ( nx == nWidth ) break;
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat >> 5));
|
||||
if ( nx == nWidth ) break;
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat >> 4));
|
||||
if ( nx == nWidth ) break;
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat >> 3));
|
||||
if ( nx == nWidth ) break;
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat >> 2));
|
||||
if ( nx == nWidth ) break;
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat >> 1));
|
||||
if ( nx == nWidth ) break;
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat));
|
||||
break;
|
||||
case 2:
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat >> 6));
|
||||
if ( nx == nWidth ) break;
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor((nDat>>4)&3));
|
||||
if ( nx == nWidth ) break;
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor((nDat>>2)&3));
|
||||
if ( nx == nWidth ) break;
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat & 3));
|
||||
break;
|
||||
case 4:
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat >> 4));
|
||||
if ( nx == nWidth ) break;
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat));
|
||||
break;
|
||||
case 8:
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nDat));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#define BITMAPERROR \
|
||||
{ \
|
||||
@@ -876,6 +877,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
|
||||
|
||||
for (sal_uInt16 ny = 0; ny < nHeight; ++ny)
|
||||
{
|
||||
Scanline pScanline = pAcc->GetScanline(ny);
|
||||
sal_uInt16 nx = 0;
|
||||
if ( nRowBytes < 8 || nPackType == 1 )
|
||||
{
|
||||
@@ -883,7 +885,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
|
||||
{
|
||||
pPict->ReadUChar( nDat );
|
||||
if ( nx < nWidth )
|
||||
SETBYTE;
|
||||
SetByte(nx, pScanline, pAcc, nPixelSize, nDat, nWidth);
|
||||
}
|
||||
nDataSize += nRowBytes;
|
||||
}
|
||||
@@ -914,7 +916,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
|
||||
{
|
||||
pPict->ReadUChar( nDat );
|
||||
if ( nx < nWidth )
|
||||
SETBYTE;
|
||||
SetByte(nx, pScanline, pAcc, nPixelSize, nDat, nWidth);
|
||||
}
|
||||
nByteCount -= 1 + nCount;
|
||||
}
|
||||
@@ -925,7 +927,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
|
||||
for (size_t i = 0; i < nCount; ++i)
|
||||
{
|
||||
if ( nx < nWidth )
|
||||
SETBYTE;
|
||||
SetByte(nx, pScanline, pAcc, nPixelSize, nDat, nWidth);
|
||||
}
|
||||
nByteCount -= 2;
|
||||
}
|
||||
@@ -962,13 +964,14 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
|
||||
sal_uInt16 nx = 0;
|
||||
if ( nRowBytes < 8 || nPackType == 1 )
|
||||
{
|
||||
Scanline pScanline = pAcc->GetScanline(ny);
|
||||
for (size_t i = 0; i < nWidth; ++i)
|
||||
{
|
||||
pPict->ReadUInt16( nD );
|
||||
nRed = static_cast<sal_uInt8>( nD >> 7 );
|
||||
nGreen = static_cast<sal_uInt8>( nD >> 2 );
|
||||
nBlue = static_cast<sal_uInt8>( nD << 3 );
|
||||
pAcc->SetPixel( ny, nx++, BitmapColor( nRed, nGreen, nBlue ) );
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nRed, nGreen, nBlue));
|
||||
}
|
||||
nDataSize += static_cast<sal_uLong>(nWidth) * 2;
|
||||
}
|
||||
@@ -1001,13 +1004,14 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
|
||||
this case. Have a look at 32bit, there I changed the
|
||||
encoding, so that it is used a straight forward array
|
||||
*/
|
||||
Scanline pScanline = pAcc->GetScanline(ny);
|
||||
for (size_t i = 0; i < nCount; ++i)
|
||||
{
|
||||
pPict->ReadUInt16( nD );
|
||||
nRed = static_cast<sal_uInt8>( nD >> 7 );
|
||||
nGreen = static_cast<sal_uInt8>( nD >> 2 );
|
||||
nBlue = static_cast<sal_uInt8>( nD << 3 );
|
||||
pAcc->SetPixel( ny, nx++, BitmapColor( nRed, nGreen, nBlue ) );
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nRed, nGreen, nBlue));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1021,9 +1025,10 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
|
||||
nRed = static_cast<sal_uInt8>( nD >> 7 );
|
||||
nGreen = static_cast<sal_uInt8>( nD >> 2 );
|
||||
nBlue = static_cast<sal_uInt8>( nD << 3 );
|
||||
Scanline pScanline = pAcc->GetScanline(ny);
|
||||
for (size_t i = 0; i < nCount; ++i)
|
||||
{
|
||||
pAcc->SetPixel( ny, nx++, BitmapColor( nRed, nGreen, nBlue ) );
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nRed, nGreen, nBlue));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1056,11 +1061,12 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
|
||||
|
||||
for (sal_uInt16 ny = 0; ny < nHeight; ++ny)
|
||||
{
|
||||
Scanline pScanline = pAcc->GetScanline(ny);
|
||||
for (sal_uInt16 nx = 0; nx < nWidth; ++nx)
|
||||
{
|
||||
sal_uInt8 nDummy;
|
||||
pPict->ReadUChar( nDummy ).ReadUChar( nRed ).ReadUChar( nGreen ).ReadUChar( nBlue );
|
||||
pAcc->SetPixel( ny, nx, BitmapColor( nRed, nGreen, nBlue) );
|
||||
pAcc->SetPixelOnData(pScanline, nx, BitmapColor(nRed, nGreen, nBlue));
|
||||
}
|
||||
nDataSize += static_cast<sal_uLong>(nWidth) * 4;
|
||||
}
|
||||
@@ -1080,10 +1086,11 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
|
||||
|
||||
for (sal_uInt16 ny = 0; ny < nHeight; ++ny)
|
||||
{
|
||||
Scanline pScanline = pAcc->GetScanline(ny);
|
||||
for (sal_uInt16 nx = 0; nx < nWidth; ++nx)
|
||||
{
|
||||
pPict->ReadUChar( nRed ).ReadUChar( nGreen ).ReadUChar( nBlue );
|
||||
pAcc->SetPixel( ny, nx, BitmapColor( nRed, nGreen, nBlue ) );
|
||||
pAcc->SetPixelOnData(pScanline, nx, BitmapColor(nRed, nGreen, nBlue));
|
||||
}
|
||||
nDataSize += static_cast<sal_uLong>(nWidth) * 3;
|
||||
}
|
||||
@@ -1149,8 +1156,9 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
|
||||
sal_uInt8* pTmp = aScanline.data();
|
||||
if ( nCmpCount == 4 )
|
||||
pTmp += nWidth;
|
||||
Scanline pScanline = pAcc->GetScanline(ny);
|
||||
for (sal_uInt16 nx = 0; nx < nWidth; pTmp++)
|
||||
pAcc->SetPixel( ny, nx++, BitmapColor( *pTmp, pTmp[ nWidth ], pTmp[ 2 * nWidth ] ) );
|
||||
pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(*pTmp, pTmp[ nWidth ], pTmp[ 2 * nWidth ]));
|
||||
nDataSize += static_cast<sal_uLong>(nByteCount);
|
||||
pPict->Seek( nSrcBitsPos + static_cast<sal_uLong>(nByteCount) );
|
||||
}
|
||||
|
@@ -789,6 +789,10 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
|
||||
{
|
||||
sal_uInt8* pt = getMapData(0);
|
||||
|
||||
Scanline pMaskScanLine = nullptr;
|
||||
if (nSamplesPerPixel >= 4 && xMaskAcc)
|
||||
pMaskScanLine = xMaskAcc->GetScanline(nY);
|
||||
|
||||
// are the values being saved as difference?
|
||||
if ( 2 == nPredictor )
|
||||
{
|
||||
@@ -801,11 +805,11 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
|
||||
nLRed = nLRed + pt[ 0 ];
|
||||
nLGreen = nLGreen + pt[ 1 ];
|
||||
nLBlue = nLBlue + pt[ 2 ];
|
||||
pAcc->SetPixel( nY, nx, Color( nLRed, nLGreen, nLBlue ) );
|
||||
if (nSamplesPerPixel >= 4 && xMaskAcc)
|
||||
pAcc->SetPixelOnData(pScanLine, nx, Color(nLRed, nLGreen, nLBlue));
|
||||
if (pMaskScanLine)
|
||||
{
|
||||
nLAlpha = nLAlpha + pt[ 3 ];
|
||||
xMaskAcc->SetPixel( nY, nx, BitmapColor(~nLAlpha) );
|
||||
xMaskAcc->SetPixelOnData(pMaskScanLine, nx, BitmapColor(~nLAlpha));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -813,11 +817,11 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
|
||||
{
|
||||
for (sal_Int32 nx = 0; nx < nImageWidth; nx++, pt += nSamplesPerPixel)
|
||||
{
|
||||
pAcc->SetPixel( nY, nx, Color( pt[0], pt[1], pt[2] ) );
|
||||
if (nSamplesPerPixel >= 4 && xMaskAcc)
|
||||
pAcc->SetPixelOnData(pScanLine, nx, Color(pt[0], pt[1], pt[2]));
|
||||
if (pMaskScanLine)
|
||||
{
|
||||
sal_uInt8 nAlpha = pt[3];
|
||||
xMaskAcc->SetPixel( nY, nx, BitmapColor(~nAlpha) );
|
||||
xMaskAcc->SetPixelOnData(pMaskScanLine, nx, BitmapColor(~nAlpha));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -841,7 +845,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
|
||||
nGreen = GetBits( getMapData(1), nx * nBitsPerSample, nBitsPerSample );
|
||||
nBlue = GetBits( getMapData(2), nx * nBitsPerSample, nBitsPerSample );
|
||||
}
|
||||
pAcc->SetPixel( nY, nx, Color( static_cast<sal_uInt8>( nRed - nMinMax ), static_cast<sal_uInt8>( nGreen - nMinMax ), static_cast<sal_uInt8>(nBlue - nMinMax) ) );
|
||||
pAcc->SetPixelOnData(pScanLine, nx, Color(static_cast<sal_uInt8>(nRed - nMinMax), static_cast<sal_uInt8>(nGreen - nMinMax), static_cast<sal_uInt8>(nBlue - nMinMax)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -867,7 +871,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
|
||||
nRed = 255 - static_cast<sal_uInt8>( nRed - nMinMax );
|
||||
nGreen = 255 - static_cast<sal_uInt8>( nGreen - nMinMax );
|
||||
nBlue = 255 - static_cast<sal_uInt8>( nBlue - nMinMax );
|
||||
pAcc->SetPixel( nY, nx, Color( static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue) ) );
|
||||
pAcc->SetPixelOnData(pScanLine, nx, Color(static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -909,7 +913,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
|
||||
255L/static_cast<sal_Int32>(nMaxSampleValue-nMinSampleValue) ) ));
|
||||
nBlue = static_cast<sal_uInt8>(std::max( 0L, 255L - ( ( static_cast<sal_Int32>(nSamp[ 2 ]) + nBlack - ( static_cast<sal_Int32>(nMinSampleValue) << 1 ) ) *
|
||||
255L/static_cast<sal_Int32>(nMaxSampleValue-nMinSampleValue) ) ));
|
||||
pAcc->SetPixel( nY, nx, Color ( static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue) ) );
|
||||
pAcc->SetPixelOnData(pScanLine, nx, Color(static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1117,6 +1117,7 @@ void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, SvStream
|
||||
{
|
||||
for ( long nY = 0; nY < aBitmapSizePixel.Height(); nY++ )
|
||||
{
|
||||
Scanline pScanline = pAcc->GetScanline(nY);
|
||||
for ( long nX = 0; nX < aBitmapSizePixel.Width(); nX++ )
|
||||
{
|
||||
double fX = static_cast< double >( nX ) / aBitmapSizePixel.Width();
|
||||
@@ -1233,7 +1234,7 @@ void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, SvStream
|
||||
if ( nBlue > 255 )
|
||||
nBlue = 255;
|
||||
|
||||
pAcc->SetPixel( nY, nX, BitmapColor( static_cast< sal_Int8 >( nRed ), static_cast< sal_Int8 >( nGreen ), static_cast< sal_Int8 >( nBlue ) ) );
|
||||
pAcc->SetPixelOnData(pScanline, nX, BitmapColor(static_cast<sal_Int8>(nRed), static_cast<sal_Int8>(nGreen), static_cast<sal_Int8>(nBlue)));
|
||||
}
|
||||
}
|
||||
Bitmap::ReleaseAccess( pAcc );
|
||||
@@ -1376,6 +1377,7 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
|
||||
|
||||
for (long y = 0; y < pWrite->Height(); ++y)
|
||||
{
|
||||
Scanline pScanline = pWrite->GetScanline(y);
|
||||
for (long x = 0; x < pWrite->Width(); ++x)
|
||||
{
|
||||
Color aReadColor;
|
||||
@@ -1385,9 +1387,9 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
|
||||
aReadColor = pRead->GetPixel(y, x);
|
||||
|
||||
if (aReadColor.GetColor() == 0)
|
||||
pWrite->SetPixel(y, x, aCol2);
|
||||
pWrite->SetPixelOnData(pScanline, x, aCol2);
|
||||
else
|
||||
pWrite->SetPixel(y, x, aCol1);
|
||||
pWrite->SetPixelOnData(pScanline, x, aCol1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -241,8 +241,9 @@ bool XBMReader::ParseData( SvStream* pInStm, const OString& aLastLine, XBMFormat
|
||||
|
||||
if( bProcessed )
|
||||
{
|
||||
Scanline pScanline = pAcc1->GetScanline(nRow);
|
||||
while( ( nCol < nWidth ) && ( nBit < nBits ) )
|
||||
pAcc1->SetPixel( nRow, nCol++, ( nValue & ( 1 << nBit++ ) ) ? aBlack : aWhite );
|
||||
pAcc1->SetPixelOnData(pScanline, nCol++, ( nValue & ( 1 << nBit++ ) ) ? aBlack : aWhite);
|
||||
|
||||
if( nCol == nWidth )
|
||||
{
|
||||
|
@@ -305,6 +305,8 @@ bool XPMReader::ImplGetScanLine( sal_uLong nY )
|
||||
bStatus = false;
|
||||
else
|
||||
{
|
||||
Scanline pScanline = mpAcc->GetScanline(nY);
|
||||
Scanline pMaskScanline = mpMaskAcc ? mpMaskAcc->GetScanline(nY) : nullptr;
|
||||
for (sal_uLong i = 0; i < mnWidth; ++i)
|
||||
{
|
||||
OString aKey(reinterpret_cast<sal_Char*>(pString), mnCpp);
|
||||
@@ -312,11 +314,11 @@ bool XPMReader::ImplGetScanLine( sal_uLong nY )
|
||||
if (it != maColMap.end())
|
||||
{
|
||||
if (mnColors > 256)
|
||||
mpAcc->SetPixel(nY, i, Color(it->second[1], it->second[2], it->second[3]));
|
||||
mpAcc->SetPixelOnData(pScanline, i, Color(it->second[1], it->second[2], it->second[3]));
|
||||
else
|
||||
mpAcc->SetPixel(nY, i, BitmapColor(it->second[1]));
|
||||
if (mpMaskAcc)
|
||||
mpMaskAcc->SetPixel(nY, i, it->second[0] ? aWhite : aBlack);
|
||||
mpAcc->SetPixelOnData(pScanline, i, BitmapColor(it->second[1]));
|
||||
if (pMaskScanline)
|
||||
mpMaskAcc->SetPixelOnData(pMaskScanline, i, it->second[0] ? aWhite : aBlack);
|
||||
}
|
||||
pString += mnCpp;
|
||||
}
|
||||
|
@@ -376,6 +376,7 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & rHeader, BitmapWriteA
|
||||
|
||||
if( nRunByte > 2 )
|
||||
{
|
||||
Scanline pScanline = rAcc.GetScanline(nY);
|
||||
if( bRLE4 )
|
||||
{
|
||||
nCountByte = nRunByte >> 1;
|
||||
@@ -388,10 +389,10 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & rHeader, BitmapWriteA
|
||||
cTmp = *pRLE++;
|
||||
|
||||
if( nX < nWidth )
|
||||
rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp >> 4, rPalette, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX++, BitmapColor(SanitizePaletteIndex(cTmp >> 4, rPalette, bForceToMonoWhileReading)));
|
||||
|
||||
if( nX < nWidth )
|
||||
rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp & 0x0f, rPalette, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX++, BitmapColor(SanitizePaletteIndex(cTmp & 0x0f, rPalette, bForceToMonoWhileReading)));
|
||||
}
|
||||
|
||||
if( nRunByte & 1 )
|
||||
@@ -400,7 +401,7 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & rHeader, BitmapWriteA
|
||||
return false;
|
||||
|
||||
if( nX < nWidth )
|
||||
rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(*pRLE >> 4, rPalette, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX++, BitmapColor(SanitizePaletteIndex(*pRLE >> 4, rPalette, bForceToMonoWhileReading)));
|
||||
|
||||
pRLE++;
|
||||
}
|
||||
@@ -421,7 +422,7 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & rHeader, BitmapWriteA
|
||||
return false;
|
||||
|
||||
if( nX < nWidth )
|
||||
rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(*pRLE, rPalette, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX++, BitmapColor(SanitizePaletteIndex(*pRLE, rPalette, bForceToMonoWhileReading)));
|
||||
|
||||
pRLE++;
|
||||
}
|
||||
@@ -461,6 +462,7 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & rHeader, BitmapWriteA
|
||||
return false;
|
||||
cTmp = *pRLE++;
|
||||
|
||||
Scanline pScanline = rAcc.GetScanline(nY);
|
||||
if( bRLE4 )
|
||||
{
|
||||
nRunByte = nCountByte >> 1;
|
||||
@@ -468,19 +470,19 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & rHeader, BitmapWriteA
|
||||
for( sal_uLong i = 0; i < nRunByte; i++ )
|
||||
{
|
||||
if( nX < nWidth )
|
||||
rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp >> 4, rPalette, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX++, BitmapColor(SanitizePaletteIndex(cTmp >> 4, rPalette, bForceToMonoWhileReading)));
|
||||
|
||||
if( nX < nWidth )
|
||||
rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp & 0x0f, rPalette, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX++, BitmapColor(SanitizePaletteIndex(cTmp & 0x0f, rPalette, bForceToMonoWhileReading)));
|
||||
}
|
||||
|
||||
if( ( nCountByte & 1 ) && ( nX < nWidth ) )
|
||||
rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp >> 4, rPalette, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX++, BitmapColor(SanitizePaletteIndex(cTmp >> 4, rPalette, bForceToMonoWhileReading)));
|
||||
}
|
||||
else
|
||||
{
|
||||
for( sal_uLong i = 0; ( i < nCountByte ) && ( nX < nWidth ); i++ )
|
||||
rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp, rPalette, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX++, BitmapColor(SanitizePaletteIndex(cTmp, rPalette, bForceToMonoWhileReading)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -584,7 +586,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
|
||||
return false;
|
||||
}
|
||||
sal_uInt8 cTmp = *pTmp++;
|
||||
|
||||
Scanline pScanline = rAcc.GetScanline(nY);
|
||||
for( long nX = 0, nShift = 8; nX < nWidth; nX++ )
|
||||
{
|
||||
if( !nShift )
|
||||
@@ -594,7 +596,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
|
||||
}
|
||||
|
||||
auto nIndex = (cTmp >> --nShift) & 1;
|
||||
rAcc.SetPixelIndex(nY, nX, SanitizePaletteIndex(nIndex, rPalette, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX, BitmapColor(SanitizePaletteIndex(nIndex, rPalette, bForceToMonoWhileReading)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -611,7 +613,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
|
||||
return false;
|
||||
}
|
||||
sal_uInt8 cTmp = *pTmp++;
|
||||
|
||||
Scanline pScanline = rAcc.GetScanline(nY);
|
||||
for( long nX = 0, nShift = 2; nX < nWidth; nX++ )
|
||||
{
|
||||
if( !nShift )
|
||||
@@ -621,7 +623,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
|
||||
}
|
||||
|
||||
auto nIndex = (cTmp >> ( --nShift << 2 ) ) & 0x0f;
|
||||
rAcc.SetPixelIndex(nY, nX, SanitizePaletteIndex(nIndex, rPalette, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX, BitmapColor(SanitizePaletteIndex(nIndex, rPalette, bForceToMonoWhileReading)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -638,10 +640,11 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
|
||||
return false;
|
||||
}
|
||||
|
||||
Scanline pScanline = rAcc.GetScanline(nY);
|
||||
for( long nX = 0; nX < nWidth; nX++ )
|
||||
{
|
||||
auto nIndex = *pTmp++;
|
||||
rAcc.SetPixelIndex(nY, nX, SanitizePaletteIndex(nIndex, rPalette, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX, BitmapColor(SanitizePaletteIndex(nIndex, rPalette, bForceToMonoWhileReading)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -671,10 +674,11 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
|
||||
return false;
|
||||
}
|
||||
|
||||
Scanline pScanline = rAcc.GetScanline(nY);
|
||||
for( long nX = 0; nX < nWidth; nX++ )
|
||||
{
|
||||
aMask.GetColorFor16BitLSB( aColor, reinterpret_cast<sal_uInt8*>(pTmp16++) );
|
||||
rAcc.SetPixel(nY, nX, SanitizeColor(aColor, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX, SanitizeColor(aColor, bForceToMonoWhileReading));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -693,12 +697,13 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
|
||||
return false;
|
||||
}
|
||||
|
||||
Scanline pScanline = rAcc.GetScanline(nY);
|
||||
for( long nX = 0; nX < nWidth; nX++ )
|
||||
{
|
||||
aPixelColor.SetBlue( *pTmp++ );
|
||||
aPixelColor.SetGreen( *pTmp++ );
|
||||
aPixelColor.SetRed( *pTmp++ );
|
||||
rAcc.SetPixel(nY, nX, SanitizeColor(aPixelColor, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX, SanitizeColor(aPixelColor, bForceToMonoWhileReading));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -733,11 +738,13 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
|
||||
return false;
|
||||
}
|
||||
|
||||
Scanline pScanline = rAcc.GetScanline(nY);
|
||||
Scanline pAlphaScanline = pAccAlpha->GetScanline(nY);
|
||||
for( long nX = 0; nX < nWidth; nX++ )
|
||||
{
|
||||
aMask.GetColorAndAlphaFor32Bit( aColor, aAlpha, reinterpret_cast<sal_uInt8*>(pTmp32++) );
|
||||
rAcc.SetPixel(nY, nX, SanitizeColor(aColor, bForceToMonoWhileReading));
|
||||
pAccAlpha->SetPixelIndex(nY, nX, sal_uInt8(0xff) - aAlpha);
|
||||
rAcc.SetPixelOnData(pScanline, nX, SanitizeColor(aColor, bForceToMonoWhileReading));
|
||||
pAccAlpha->SetPixelOnData(pAlphaScanline, nX, BitmapColor(sal_uInt8(0xff) - aAlpha));
|
||||
rAlphaUsed |= 0xff != aAlpha;
|
||||
}
|
||||
}
|
||||
@@ -753,10 +760,11 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
|
||||
return false;
|
||||
}
|
||||
|
||||
Scanline pScanline = rAcc.GetScanline(nY);
|
||||
for( long nX = 0; nX < nWidth; nX++ )
|
||||
{
|
||||
aMask.GetColorFor32Bit( aColor, reinterpret_cast<sal_uInt8*>(pTmp32++) );
|
||||
rAcc.SetPixel(nY, nX, SanitizeColor(aColor, bForceToMonoWhileReading));
|
||||
rAcc.SetPixelOnData(pScanline, nX, SanitizeColor(aColor, bForceToMonoWhileReading));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user