[Libreoffice-commits] .: filter/source
Caolán McNamara
caolan at kemper.freedesktop.org
Sun Dec 5 04:54:25 PST 2010
filter/source/graphicfilter/ipcx/ipcx.cxx | 54 +++++++++++++++---------------
1 file changed, 27 insertions(+), 27 deletions(-)
New commits:
commit 6e0776ea7ff2a52dcda4e03f113c326ddc6af290
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Dec 5 12:54:15 2010 +0000
tidy this up and just use references
diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx
index 52fb115..48085b1 100644
--- a/filter/source/graphicfilter/ipcx/ipcx.cxx
+++ b/filter/source/graphicfilter/ipcx/ipcx.cxx
@@ -39,7 +39,7 @@ class PCXReader {
private:
- SvStream* pPCX; // Die einzulesende PCX-Datei
+ SvStream& m_rPCX; // Die einzulesende PCX-Datei
Bitmap aBmp;
BitmapWriteAccess* pAcc;
@@ -63,16 +63,17 @@ private:
void ImplReadHeader();
public:
- PCXReader();
+ PCXReader(SvStream &rStream);
~PCXReader();
- BOOL ReadPCX( SvStream & rPCX, Graphic & rGraphic );
+ BOOL ReadPCX(Graphic & rGraphic );
// Liesst aus dem Stream eine PCX-Datei und fuellt das GDIMetaFile
};
//=================== Methoden von PCXReader ==============================
-PCXReader::PCXReader() :
- pAcc ( NULL )
+PCXReader::PCXReader(SvStream &rStream)
+ : m_rPCX(rStream)
+ , pAcc(NULL)
{
pPalette = new BYTE[ 768 ];
}
@@ -95,9 +96,9 @@ BOOL PCXReader::Callback( USHORT /*nPercent*/ )
return FALSE;
}
-BOOL PCXReader::ReadPCX( SvStream & rPCX, Graphic & rGraphic )
+BOOL PCXReader::ReadPCX(Graphic & rGraphic)
{
- if ( rPCX.GetError() )
+ if ( m_rPCX.GetError() )
return FALSE;
ULONG* pDummy = new ULONG; delete pDummy; // damit unter OS/2
@@ -106,8 +107,7 @@ BOOL PCXReader::ReadPCX( SvStream & rPCX, Graphic & rGraphic )
// in dieser DLL nur Vector-news
// gibt;
- pPCX = &rPCX;
- pPCX->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+ m_rPCX.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
// Kopf einlesen:
@@ -140,7 +140,7 @@ BOOL PCXReader::ReadPCX( SvStream & rPCX, Graphic & rGraphic )
if ( nDestBitsPerPixel == 8 && nStatus )
{
BYTE* pPal = pPalette;
- pPCX->SeekRel(1);
+ m_rPCX.SeekRel(1);
ImplReadPalette(256);
pAcc->SetPaletteEntryCount( 256 );
for ( USHORT i = 0; i < 256; i++, pPal += 3 )
@@ -171,15 +171,15 @@ void PCXReader::ImplReadHeader()
USHORT nushort;
USHORT nMinX,nMinY,nMaxX,nMaxY;
- *pPCX >> nbyte >> nVersion >> nEncoding;
+ m_rPCX >> nbyte >> nVersion >> nEncoding;
if ( nbyte!=0x0a || (nVersion != 0 && nVersion != 2 && nVersion != 3 && nVersion != 5) || nEncoding > 1 )
{
nStatus = FALSE;
return;
}
- *pPCX >> nbyte; nBitsPerPlanePix = (ULONG)nbyte;
- *pPCX >> nMinX >> nMinY >> nMaxX >> nMaxY;
+ m_rPCX >> nbyte; nBitsPerPlanePix = (ULONG)nbyte;
+ m_rPCX >> nMinX >> nMinY >> nMaxX >> nMaxY;
if ((nMinX > nMaxX) || (nMinY > nMaxY))
{
@@ -190,19 +190,19 @@ void PCXReader::ImplReadHeader()
nWidth = nMaxX-nMinX+1;
nHeight = nMaxY-nMinY+1;
- *pPCX >> nResX;
- *pPCX >> nResY;
+ m_rPCX >> nResX;
+ m_rPCX >> nResY;
if ( nResX >= nWidth || nResY >= nHeight || ( nResX != nResY ) )
nResX = nResY = 0;
ImplReadPalette( 16 );
- pPCX->SeekRel( 1 );
- *pPCX >> nbyte; nPlanes = (ULONG)nbyte;
- *pPCX >> nushort; nBytesPerPlaneLin = (ULONG)nushort;
- *pPCX >> nPaletteInfo;
+ m_rPCX.SeekRel( 1 );
+ m_rPCX >> nbyte; nPlanes = (ULONG)nbyte;
+ m_rPCX >> nushort; nBytesPerPlaneLin = (ULONG)nushort;
+ m_rPCX >> nPaletteInfo;
- pPCX->SeekRel( 58 );
+ m_rPCX.SeekRel( 58 );
nDestBitsPerPixel = (USHORT)( nBitsPerPlanePix * nPlanes );
if (nDestBitsPerPixel == 2 || nDestBitsPerPixel == 3) nDestBitsPerPixel = 4;
@@ -239,7 +239,7 @@ void PCXReader::ImplReadBody()
nCount = 0;
for ( ny = 0; ny < nHeight; ny++ )
{
- if (pPCX->GetError() || pPCX->IsEof())
+ if (m_rPCX.GetError() || m_rPCX.IsEof())
{
nStatus = FALSE;
break;
@@ -254,7 +254,7 @@ void PCXReader::ImplReadBody()
for ( np = 0; np < nPlanes; np++)
{
if ( nEncoding == 0)
- pPCX->Read( (void *)pPlane[ np ], nBytesPerPlaneLin );
+ m_rPCX.Read( (void *)pPlane[ np ], nBytesPerPlaneLin );
else
{
pDest = pPlane[ np ];
@@ -267,11 +267,11 @@ void PCXReader::ImplReadBody()
}
while ( nx > 0 )
{
- *pPCX >> nDat;
+ m_rPCX >> nDat;
if ( ( nDat & 0xc0 ) == 0xc0 )
{
nCount =( (ULONG)nDat ) & 0x003f;
- *pPCX >> nDat;
+ m_rPCX >> nDat;
if ( nCount < nx )
{
nx -= nCount;
@@ -412,7 +412,7 @@ void PCXReader::ImplReadPalette( ULONG nCol )
BYTE* pPtr = pPalette;
for ( ULONG i = 0; i < nCol; i++ )
{
- *pPCX >> r >> g >> b;
+ m_rPCX >> r >> g >> b;
*pPtr++ = r;
*pPtr++ = g;
*pPtr++ = b;
@@ -423,8 +423,8 @@ void PCXReader::ImplReadPalette( ULONG nCol )
extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
{
- PCXReader aPCXReader;
- BOOL nRetValue = aPCXReader.ReadPCX( rStream, rGraphic );
+ PCXReader aPCXReader(rStream);
+ BOOL nRetValue = aPCXReader.ReadPCX(rGraphic);
if ( nRetValue == FALSE )
rStream.SetError( SVSTREAM_FILEFORMAT_ERROR );
return nRetValue;
More information about the Libreoffice-commits
mailing list