[Libreoffice-commits] .: 4 commits - filter/source
Caolán McNamara
caolan at kemper.freedesktop.org
Sat Jan 15 06:46:43 PST 2011
filter/source/graphicfilter/epgm/epgm.cxx | 62 ++++++------
filter/source/graphicfilter/eppm/eppm.cxx | 64 ++++++------
filter/source/graphicfilter/eras/eras.cxx | 53 +++++-----
filter/source/graphicfilter/etiff/etiff.cxx | 139 +++++++++++++---------------
4 files changed, 156 insertions(+), 162 deletions(-)
New commits:
commit 3e34c9c605f03f7ab2230d3b600343737171b3dd
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jan 15 14:42:37 2011 +0000
no need for the pointer fetishism
diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx
index e61d38d..b9a78cb 100644
--- a/filter/source/graphicfilter/etiff/etiff.cxx
+++ b/filter/source/graphicfilter/etiff/etiff.cxx
@@ -71,7 +71,7 @@ class TIFFWriter
{
private:
- SvStream* mpOStm;
+ SvStream& m_rOStm;
UINT32 mnStreamOfs;
BOOL mbStatus;
@@ -119,24 +119,25 @@ private:
public:
- TIFFWriter();
- ~TIFFWriter();
+ TIFFWriter(SvStream &rStream);
+ ~TIFFWriter();
- BOOL WriteTIFF( const Graphic& rGraphic, SvStream& rTIFF, FilterConfigItem* pFilterConfigItem );
+ BOOL WriteTIFF( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem );
};
// ------------------------------------------------------------------------
-TIFFWriter::TIFFWriter() :
- mbStatus ( TRUE ),
- mpAcc ( NULL ),
- mnCurAllPictHeight ( 0 ),
- mnSumOfAllPictHeight( 0 ),
- mnLastPercent ( 0 ),
- mnXResPos ( 0 ),
- mnYResPos ( 0 ),
- mnBitmapPos ( 0 ),
- mnStripByteCountPos ( 0 )
+TIFFWriter::TIFFWriter(SvStream &rStream)
+ : m_rOStm(rStream)
+ , mbStatus(TRUE)
+ , mpAcc(NULL)
+ , mnCurAllPictHeight(0)
+ , mnSumOfAllPictHeight(0)
+ , mnLastPercent(0)
+ , mnXResPos(0)
+ , mnYResPos(0)
+ , mnBitmapPos(0)
+ , mnStripByteCountPos(0)
{
}
@@ -148,7 +149,7 @@ TIFFWriter::~TIFFWriter()
// ------------------------------------------------------------------------
-BOOL TIFFWriter::WriteTIFF( const Graphic& rGraphic, SvStream& rTIFF, FilterConfigItem* pFilterConfigItem)
+BOOL TIFFWriter::WriteTIFF( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem)
{
ULONG* pDummy = new ULONG; delete pDummy; // damit unter OS/2
// das richtige (Tools-)new
@@ -166,18 +167,15 @@ BOOL TIFFWriter::WriteTIFF( const Graphic& rGraphic, SvStream& rTIFF, FilterConf
}
}
- // #i69169# copy stream
- mpOStm = &rTIFF;
-
- const UINT16 nOldFormat = mpOStm->GetNumberFormatInt();
- mnStreamOfs = mpOStm->Tell();
+ const UINT16 nOldFormat = m_rOStm.GetNumberFormatInt();
+ mnStreamOfs = m_rOStm.Tell();
// we will use the BIG Endian Mode
// TIFF header
- mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
- *mpOStm << (UINT32)0x4d4d002a; // TIFF identifier
- mnLatestIfdPos = mpOStm->Tell();
- *mpOStm << (UINT32)0;
+ m_rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ m_rOStm << (UINT32)0x4d4d002a; // TIFF identifier
+ mnLatestIfdPos = m_rOStm.Tell();
+ m_rOStm << (UINT32)0;
Animation aAnimation;
Bitmap aBmp;
@@ -225,10 +223,10 @@ BOOL TIFFWriter::WriteTIFF( const Graphic& rGraphic, SvStream& rTIFF, FilterConf
ImplWritePalette();
ImplWriteBody();
}
- UINT32 nCurPos = mpOStm->Tell();
- mpOStm->Seek( mnCurrentTagCountPos );
- *mpOStm << mnTagCount;
- mpOStm->Seek( nCurPos );
+ UINT32 nCurPos = m_rOStm.Tell();
+ m_rOStm.Seek( mnCurrentTagCountPos );
+ m_rOStm << mnTagCount;
+ m_rOStm.Seek( nCurPos );
aBmp.ReleaseAccess( mpAcc );
}
@@ -236,7 +234,7 @@ BOOL TIFFWriter::WriteTIFF( const Graphic& rGraphic, SvStream& rTIFF, FilterConf
mbStatus = FALSE;
}
}
- mpOStm->SetNumberFormatInt( nOldFormat );
+ m_rOStm.SetNumberFormatInt( nOldFormat );
if ( xStatusIndicator.is() )
xStatusIndicator->end();
@@ -270,14 +268,14 @@ BOOL TIFFWriter::ImplWriteHeader( BOOL bMultiPage )
if ( mnWidth && mnHeight && mnBitsPerPixel && mbStatus )
{
- UINT32 nCurrentPos = mpOStm->Tell();
- mpOStm->Seek( mnLatestIfdPos );
- *mpOStm << (UINT32)( nCurrentPos - mnStreamOfs ); // offset to the IFD
- mpOStm->Seek( nCurrentPos );
+ UINT32 nCurrentPos = m_rOStm.Tell();
+ m_rOStm.Seek( mnLatestIfdPos );
+ m_rOStm << (UINT32)( nCurrentPos - mnStreamOfs ); // offset to the IFD
+ m_rOStm.Seek( nCurrentPos );
// (OFS8) TIFF image file directory (IFD)
- mnCurrentTagCountPos = mpOStm->Tell();
- *mpOStm << (UINT16)0; // the number of tagentrys is to insert later
+ mnCurrentTagCountPos = m_rOStm.Tell();
+ m_rOStm << (UINT16)0; // the number of tagentrys is to insert later
UINT32 nSubFileFlags = 0;
if ( bMultiPage )
@@ -305,15 +303,15 @@ BOOL TIFFWriter::ImplWriteHeader( BOOL bMultiPage )
break;
}
ImplWriteTag( PhotometricInterpretation, 3, 1, nTemp );
- mnBitmapPos = mpOStm->Tell();
+ mnBitmapPos = m_rOStm.Tell();
ImplWriteTag( StripOffsets, 4, 1, 0 );
ImplWriteTag( SamplesPerPixel, 3, 1, ( mnBitsPerPixel == 24 ) ? 3 : 1 );
ImplWriteTag( RowsPerStrip, 4, 1, mnHeight ); //0xffffffff );
- mnStripByteCountPos = mpOStm->Tell();
+ mnStripByteCountPos = m_rOStm.Tell();
ImplWriteTag( StripByteCounts, 4, 1, ( ( mnWidth * mnBitsPerPixel * mnHeight ) + 7 ) >> 3 );
- mnXResPos = mpOStm->Tell();
+ mnXResPos = m_rOStm.Tell();
ImplWriteTag( XResolution, 5, 1, 0 );
- mnYResPos = mpOStm->Tell();
+ mnYResPos = m_rOStm.Tell();
ImplWriteTag( YResolution, 5, 1, 0 );
if ( mnBitsPerPixel != 1 )
ImplWriteTag( PlanarConfiguration, 3, 1, 1 ); // ( RGB ORDER )
@@ -321,13 +319,13 @@ BOOL TIFFWriter::ImplWriteHeader( BOOL bMultiPage )
if ( ( mnBitsPerPixel == 4 ) || ( mnBitsPerPixel == 8 ) )
{
mnColors = mpAcc->GetPaletteEntryCount();
- mnPalPos = mpOStm->Tell();
+ mnPalPos = m_rOStm.Tell();
ImplWriteTag( ColorMap, 3, 3 * mnColors, 0 );
}
// and last we write zero to close the num dir entries list
- mnLatestIfdPos = mpOStm->Tell();
- *mpOStm << (UINT32)0; // there are no more IFD
+ mnLatestIfdPos = m_rOStm.Tell();
+ m_rOStm << (UINT32)0; // there are no more IFD
}
else
mbStatus = FALSE;
@@ -340,25 +338,25 @@ BOOL TIFFWriter::ImplWriteHeader( BOOL bMultiPage )
void TIFFWriter::ImplWritePalette()
{
USHORT i;
- ULONG nCurrentPos = mpOStm->Tell();
- mpOStm->Seek( mnPalPos + 8 ); // the palette tag entry needs the offset
- *mpOStm << static_cast<sal_uInt32>(nCurrentPos - mnStreamOfs); // to the palette colors
- mpOStm->Seek( nCurrentPos );
+ ULONG nCurrentPos = m_rOStm.Tell();
+ m_rOStm.Seek( mnPalPos + 8 ); // the palette tag entry needs the offset
+ m_rOStm << static_cast<sal_uInt32>(nCurrentPos - mnStreamOfs); // to the palette colors
+ m_rOStm.Seek( nCurrentPos );
for ( i = 0; i < mnColors; i++ )
{
const BitmapColor& rColor = mpAcc->GetPaletteColor( i );
- *mpOStm << (UINT16)( rColor.GetRed() << 8 );
+ m_rOStm << (UINT16)( rColor.GetRed() << 8 );
}
for ( i = 0; i < mnColors; i++ )
{
const BitmapColor& rColor = mpAcc->GetPaletteColor( i );
- *mpOStm << (UINT16)( rColor.GetGreen() << 8 );
+ m_rOStm << (UINT16)( rColor.GetGreen() << 8 );
}
for ( i = 0; i < mnColors; i++ )
{
const BitmapColor& rColor = mpAcc->GetPaletteColor( i );
- *mpOStm << (UINT16)( rColor.GetBlue() << 8 );
+ m_rOStm << (UINT16)( rColor.GetBlue() << 8 );
}
}
@@ -370,10 +368,10 @@ BOOL TIFFWriter::ImplWriteBody()
BYTE nShift;
ULONG j, x, y;
- ULONG nGfxBegin = mpOStm->Tell();
- mpOStm->Seek( mnBitmapPos + 8 ); // the strip offset tag entry needs the offset
- *mpOStm << static_cast<sal_uInt32>(nGfxBegin - mnStreamOfs); // to the bitmap data
- mpOStm->Seek( nGfxBegin );
+ ULONG nGfxBegin = m_rOStm.Tell();
+ m_rOStm.Seek( mnBitmapPos + 8 ); // the strip offset tag entry needs the offset
+ m_rOStm << static_cast<sal_uInt32>(nGfxBegin - mnStreamOfs); // to the bitmap data
+ m_rOStm.Seek( nGfxBegin );
StartCompression();
@@ -462,10 +460,10 @@ BOOL TIFFWriter::ImplWriteBody()
if ( mnStripByteCountPos && mbStatus )
{
- ULONG nGfxEnd = mpOStm->Tell();
- mpOStm->Seek( mnStripByteCountPos + 8 );
- *mpOStm << static_cast<sal_uInt32>( nGfxEnd - nGfxBegin ); // mnStripByteCountPos needs the size of the compression data
- mpOStm->Seek( nGfxEnd );
+ ULONG nGfxEnd = m_rOStm.Tell();
+ m_rOStm.Seek( mnStripByteCountPos + 8 );
+ m_rOStm << static_cast<sal_uInt32>( nGfxEnd - nGfxBegin ); // mnStripByteCountPos needs the size of the compression data
+ m_rOStm.Seek( nGfxEnd );
}
return mbStatus;
}
@@ -474,12 +472,12 @@ BOOL TIFFWriter::ImplWriteBody()
void TIFFWriter::ImplWriteResolution( ULONG nStreamPos, sal_uInt32 nResolutionUnit )
{
- ULONG nCurrentPos = mpOStm->Tell();
- mpOStm->Seek( nStreamPos + 8 );
- *mpOStm << (UINT32)nCurrentPos - mnStreamOfs;
- mpOStm->Seek( nCurrentPos );
- *mpOStm << (UINT32)1;
- *mpOStm << nResolutionUnit;
+ ULONG nCurrentPos = m_rOStm.Tell();
+ m_rOStm.Seek( nStreamPos + 8 );
+ m_rOStm << (UINT32)nCurrentPos - mnStreamOfs;
+ m_rOStm.Seek( nCurrentPos );
+ m_rOStm << (UINT32)1;
+ m_rOStm << nResolutionUnit;
}
// ------------------------------------------------------------------------
@@ -488,12 +486,12 @@ void TIFFWriter::ImplWriteTag( UINT16 nTagID, UINT16 nDataType, UINT32 nNumberOf
{
mnTagCount++;
- *mpOStm << nTagID;
- *mpOStm << nDataType;
- *mpOStm << nNumberOfItems;
+ m_rOStm << nTagID;
+ m_rOStm << nDataType;
+ m_rOStm << nNumberOfItems;
if ( nDataType == 3 )
nValue <<=16; // in Big Endian Mode WORDS needed to be shifted to a DWORD
- *mpOStm << nValue;
+ m_rOStm << nValue;
}
// ------------------------------------------------------------------------
@@ -504,13 +502,13 @@ inline void TIFFWriter::WriteBits( USHORT nCode, USHORT nCodeLen )
nOffset -= nCodeLen;
while ( nOffset < 24 )
{
- *mpOStm << (BYTE)( dwShift >> 24 );
+ m_rOStm << (BYTE)( dwShift >> 24 );
dwShift <<= 8;
nOffset += 8;
}
if ( nCode == 257 && nOffset != 32 )
{
- *mpOStm << (BYTE)( dwShift >> 24 );
+ m_rOStm << (BYTE)( dwShift >> 24 );
}
}
@@ -614,7 +612,8 @@ void TIFFWriter::EndCompression()
extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL )
{
- return TIFFWriter().WriteTIFF( rGraphic, rStream, pFilterConfigItem );
+ TIFFWriter aWriter(rStream);
+ return aWriter.WriteTIFF( rGraphic, pFilterConfigItem );
}
// ---------------
commit 48bad9a050d37dd31edf32a8d321b6c8bd1d0d4c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jan 15 14:38:17 2011 +0000
no need for the pointer fetishism
diff --git a/filter/source/graphicfilter/eras/eras.cxx b/filter/source/graphicfilter/eras/eras.cxx
index 692cb29..c6b9a4e 100644
--- a/filter/source/graphicfilter/eras/eras.cxx
+++ b/filter/source/graphicfilter/eras/eras.cxx
@@ -40,7 +40,7 @@ class RASWriter {
private:
- SvStream* mpOStm;
+ SvStream & m_rOStm;
USHORT mpOStmOldModus;
BOOL mbStatus;
@@ -61,18 +61,19 @@ private:
void ImplPutByte( BYTE ); // RLE decoding
public:
- RASWriter();
- ~RASWriter();
+ RASWriter(SvStream &rStream);
+ ~RASWriter();
- BOOL WriteRAS( const Graphic& rGraphic, SvStream& rRAS, FilterConfigItem* pFilterConfigItem );
+ BOOL WriteRAS( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem );
};
//=================== Methoden von RASWriter ==============================
-RASWriter::RASWriter() :
- mbStatus ( TRUE ),
- mpAcc ( NULL ),
- mnRepCount ( 0xffffffff )
+RASWriter::RASWriter(SvStream &rStream)
+ : m_rOStm(rStream)
+ , mbStatus(TRUE)
+ , mpAcc(NULL)
+ , mnRepCount( 0xffffffff )
{
}
@@ -92,12 +93,10 @@ void RASWriter::ImplCallback( ULONG nYPos )
// ------------------------------------------------------------------------
-BOOL RASWriter::WriteRAS( const Graphic& rGraphic, SvStream& rRAS, FilterConfigItem* pFilterConfigItem)
+BOOL RASWriter::WriteRAS( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem)
{
Bitmap aBmp;
- mpOStm = &rRAS;
-
if ( pFilterConfigItem )
{
xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
@@ -122,8 +121,8 @@ BOOL RASWriter::WriteRAS( const Graphic& rGraphic, SvStream& rRAS, FilterConfigI
mpAcc = aBmp.AcquireReadAccess();
if ( mpAcc )
{
- mpOStmOldModus = mpOStm->GetNumberFormatInt();
- mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ mpOStmOldModus = m_rOStm.GetNumberFormatInt();
+ m_rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
if ( ImplWriteHeader() )
{
@@ -136,7 +135,7 @@ BOOL RASWriter::WriteRAS( const Graphic& rGraphic, SvStream& rRAS, FilterConfigI
else
mbStatus = FALSE;
- mpOStm->SetNumberFormatInt( mpOStmOldModus );
+ m_rOStm.SetNumberFormatInt( mpOStmOldModus );
if ( xStatusIndicator.is() )
xStatusIndicator->end();
@@ -158,17 +157,17 @@ BOOL RASWriter::ImplWriteHeader()
}
if ( mbStatus && mnWidth && mnHeight && mnDepth )
{
- *mpOStm << (UINT32)0x59a66a95 << (UINT32)mnWidth << (UINT32)mnHeight
+ m_rOStm << (UINT32)0x59a66a95 << (UINT32)mnWidth << (UINT32)mnHeight
<< (UINT32)mnDepth
<< (UINT32)(( ( ( ( mnWidth * mnDepth ) + 15 ) >> 4 ) << 1 ) * mnHeight)
<< (UINT32)2;
if ( mnDepth > 8 )
- *mpOStm << (UINT32)0 << (UINT32)0;
+ m_rOStm << (UINT32)0 << (UINT32)0;
else
{
- *mpOStm << (UINT32)1 << (UINT32)( mnColors * 3 );
+ m_rOStm << (UINT32)1 << (UINT32)( mnColors * 3 );
}
}
else mbStatus = FALSE;
@@ -182,9 +181,9 @@ void RASWriter::ImplWritePalette()
{
USHORT i;
- for ( i = 0; i < mnColors; *mpOStm << mpAcc->GetPaletteColor( i++ ).GetRed() ) ;
- for ( i = 0; i < mnColors; *mpOStm << mpAcc->GetPaletteColor( i++ ).GetGreen() ) ;
- for ( i = 0; i < mnColors; *mpOStm << mpAcc->GetPaletteColor( i++ ).GetBlue() ) ;
+ for ( i = 0; i < mnColors; m_rOStm << mpAcc->GetPaletteColor( i++ ).GetRed() ) ;
+ for ( i = 0; i < mnColors; m_rOStm << mpAcc->GetPaletteColor( i++ ).GetGreen() ) ;
+ for ( i = 0; i < mnColors; m_rOStm << mpAcc->GetPaletteColor( i++ ).GetBlue() ) ;
}
// ------------------------------------------------------------------------
@@ -259,15 +258,15 @@ void RASWriter::ImplPutByte( BYTE nPutThis )
{
if ( mnRepCount == 0 )
{
- *mpOStm << (BYTE)mnRepVal;
+ m_rOStm << (BYTE)mnRepVal;
if ( mnRepVal == 0x80 )
- *mpOStm << (BYTE)0;
+ m_rOStm << (BYTE)0;
}
else
{
- *mpOStm << (BYTE)0x80;
- *mpOStm << (BYTE)mnRepCount;
- *mpOStm << (BYTE)mnRepVal;
+ m_rOStm << (BYTE)0x80;
+ m_rOStm << (BYTE)mnRepCount;
+ m_rOStm << (BYTE)mnRepVal;
}
mnRepVal = nPutThis;
mnRepCount = 0;
@@ -283,9 +282,9 @@ void RASWriter::ImplPutByte( BYTE nPutThis )
extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL )
{
- RASWriter aRASWriter;
+ RASWriter aRASWriter(rStream);
- return aRASWriter.WriteRAS( rGraphic, rStream, pFilterConfigItem );
+ return aRASWriter.WriteRAS( rGraphic, pFilterConfigItem );
}
// ---------------
commit 0ba54c796c16abb1a3e881265cf595ed9d28db82
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jan 15 14:36:42 2011 +0000
no need for the pointer fetishism
diff --git a/filter/source/graphicfilter/epgm/epgm.cxx b/filter/source/graphicfilter/epgm/epgm.cxx
index 620e293..7b8b720 100644
--- a/filter/source/graphicfilter/epgm/epgm.cxx
+++ b/filter/source/graphicfilter/epgm/epgm.cxx
@@ -46,7 +46,7 @@ class PGMWriter {
private:
- SvStream* mpOStm; // Die auszugebende PGM-Datei
+ SvStream& m_rOStm; // Die auszugebende PGM-Datei
USHORT mpOStmOldModus;
BOOL mbStatus;
@@ -61,17 +61,18 @@ private:
com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
public:
- PGMWriter();
- ~PGMWriter();
+ PGMWriter(SvStream &rStream);
+ ~PGMWriter();
- BOOL WritePGM( const Graphic& rGraphic, SvStream& rPGM, FilterConfigItem* pFilterConfigItem );
+ BOOL WritePGM( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem );
};
//=================== Methoden von PGMWriter ==============================
-PGMWriter::PGMWriter() :
- mbStatus ( TRUE ),
- mpAcc ( NULL )
+PGMWriter::PGMWriter(SvStream &rStream)
+ : m_rOStm(rStream)
+ , mbStatus(TRUE)
+ , mpAcc(NULL)
{
}
@@ -83,11 +84,8 @@ PGMWriter::~PGMWriter()
// ------------------------------------------------------------------------
-BOOL PGMWriter::WritePGM( const Graphic& rGraphic, SvStream& rPGM, FilterConfigItem* pFilterConfigItem )
+BOOL PGMWriter::WritePGM( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem )
{
-
- mpOStm = &rPGM;
-
if ( pFilterConfigItem )
{
mnMode = pFilterConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), 0 );
@@ -104,8 +102,8 @@ BOOL PGMWriter::WritePGM( const Graphic& rGraphic, SvStream& rPGM, FilterConfigI
Bitmap aBmp = aBmpEx.GetBitmap();
aBmp.Convert( BMP_CONVERSION_8BIT_GREYS );
- mpOStmOldModus = mpOStm->GetNumberFormatInt();
- mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ mpOStmOldModus = m_rOStm.GetNumberFormatInt();
+ m_rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
mpAcc = aBmp.AcquireReadAccess();
if( mpAcc )
@@ -119,7 +117,7 @@ BOOL PGMWriter::WritePGM( const Graphic& rGraphic, SvStream& rPGM, FilterConfigI
else
mbStatus = FALSE;
- mpOStm->SetNumberFormatInt( mpOStmOldModus );
+ m_rOStm.SetNumberFormatInt( mpOStmOldModus );
if ( xStatusIndicator.is() )
xStatusIndicator->end();
@@ -136,16 +134,16 @@ BOOL PGMWriter::ImplWriteHeader()
if ( mnWidth && mnHeight )
{
if ( mnMode == 0 )
- *mpOStm << "P5\x0a";
+ m_rOStm << "P5\x0a";
else
- *mpOStm << "P2\x0a";
+ m_rOStm << "P2\x0a";
ImplWriteNumber( mnWidth );
- *mpOStm << (BYTE)32;
+ m_rOStm << (BYTE)32;
ImplWriteNumber( mnHeight );
- *mpOStm << (BYTE)32;
+ m_rOStm << (BYTE)32;
ImplWriteNumber( 255 ); // max. gray value
- *mpOStm << (BYTE)10;
+ m_rOStm << (BYTE)10;
}
else
mbStatus = FALSE;
@@ -163,7 +161,7 @@ void PGMWriter::ImplWriteBody()
{
for ( ULONG x = 0; x < mnWidth; x++ )
{
- *mpOStm << (BYTE)( mpAcc->GetPixel( y, x ) );
+ m_rOStm << (BYTE)( mpAcc->GetPixel( y, x ) );
}
}
}
@@ -178,18 +176,18 @@ void PGMWriter::ImplWriteBody()
if ( nCount < 0 )
{
nCount = 69;
- *mpOStm << (BYTE)10;
+ m_rOStm << (BYTE)10;
}
nDat = (BYTE)mpAcc->GetPixel( y, x );
nNumb = nDat / 100;
if ( nNumb )
{
- *mpOStm << (BYTE)( nNumb + '0' );
+ m_rOStm << (BYTE)( nNumb + '0' );
nDat -= ( nNumb * 100 );
nNumb = nDat / 10;
- *mpOStm << (BYTE)( nNumb + '0' );
+ m_rOStm << (BYTE)( nNumb + '0' );
nDat -= ( nNumb * 10 );
- *mpOStm << (BYTE)( nDat + '0' );
+ m_rOStm << (BYTE)( nDat + '0' );
nCount -= 4;
}
else
@@ -197,20 +195,20 @@ void PGMWriter::ImplWriteBody()
nNumb = nDat / 10;
if ( nNumb )
{
- *mpOStm << (BYTE)( nNumb + '0' );
+ m_rOStm << (BYTE)( nNumb + '0' );
nDat -= ( nNumb * 10 );
- *mpOStm << (BYTE)( nDat + '0' );
+ m_rOStm << (BYTE)( nDat + '0' );
nCount -= 3;
}
else
{
- *mpOStm << (BYTE)( nDat + '0' );
+ m_rOStm << (BYTE)( nDat + '0' );
nCount -= 2;
}
}
- *mpOStm << (BYTE)' ';
+ m_rOStm << (BYTE)' ';
}
- *mpOStm << (BYTE)10;
+ m_rOStm << (BYTE)10;
}
}
}
@@ -223,7 +221,7 @@ void PGMWriter::ImplWriteNumber( sal_Int32 nNumber )
const ByteString aNum( ByteString::CreateFromInt32( nNumber ) );
for( sal_Int16 n = 0UL, nLen = aNum.Len(); n < nLen; n++ )
- *mpOStm << aNum.GetChar( n );
+ m_rOStm << aNum.GetChar( n );
}
@@ -235,9 +233,9 @@ void PGMWriter::ImplWriteNumber( sal_Int32 nNumber )
extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL )
{
- PGMWriter aPGMWriter;
+ PGMWriter aPGMWriter(rStream);
- return aPGMWriter.WritePGM( rGraphic, rStream, pFilterConfigItem );
+ return aPGMWriter.WritePGM( rGraphic, pFilterConfigItem );
}
// ------------------------------------------------------------------------
commit 207242fa0e7f942c5a5a7176e96fb9de253f26a9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jan 15 14:34:32 2011 +0000
no need for the pointer fetishism
diff --git a/filter/source/graphicfilter/eppm/eppm.cxx b/filter/source/graphicfilter/eppm/eppm.cxx
index 6818a1c..0670672 100644
--- a/filter/source/graphicfilter/eppm/eppm.cxx
+++ b/filter/source/graphicfilter/eppm/eppm.cxx
@@ -46,7 +46,7 @@ class PPMWriter {
private:
- SvStream* mpOStm; // Die auszugebende PPM-Datei
+ SvStream& m_rOStm; // Die auszugebende PPM-Datei
USHORT mpOStmOldModus;
BOOL mbStatus;
@@ -61,17 +61,18 @@ private:
com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
public:
- PPMWriter();
+ PPMWriter(SvStream &rStrm);
~PPMWriter();
- BOOL WritePPM( const Graphic& rGraphic, SvStream& rPPM, FilterConfigItem* pFilterConfigItem );
+ BOOL WritePPM( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem );
};
//=================== Methoden von PPMWriter ==============================
-PPMWriter::PPMWriter() :
- mbStatus ( TRUE ),
- mpAcc ( NULL )
+PPMWriter::PPMWriter(SvStream &rStrm)
+ : m_rOStm(rStrm)
+ , mbStatus ( TRUE )
+ , mpAcc ( NULL )
{
}
@@ -83,11 +84,8 @@ PPMWriter::~PPMWriter()
// ------------------------------------------------------------------------
-BOOL PPMWriter::WritePPM( const Graphic& rGraphic, SvStream& rPPM, FilterConfigItem* pFilterConfigItem )
+BOOL PPMWriter::WritePPM( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem )
{
-
- mpOStm = &rPPM;
-
if ( pFilterConfigItem )
{
mnMode = pFilterConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), 0 );
@@ -104,8 +102,8 @@ BOOL PPMWriter::WritePPM( const Graphic& rGraphic, SvStream& rPPM, FilterConfigI
Bitmap aBmp = aBmpEx.GetBitmap();
aBmp.Convert( BMP_CONVERSION_24BIT );
- mpOStmOldModus = mpOStm->GetNumberFormatInt();
- mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ mpOStmOldModus = m_rOStm.GetNumberFormatInt();
+ m_rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
mpAcc = aBmp.AcquireReadAccess();
if( mpAcc )
@@ -119,7 +117,7 @@ BOOL PPMWriter::WritePPM( const Graphic& rGraphic, SvStream& rPPM, FilterConfigI
else
mbStatus = FALSE;
- mpOStm->SetNumberFormatInt( mpOStmOldModus );
+ m_rOStm.SetNumberFormatInt( mpOStmOldModus );
if ( xStatusIndicator.is() )
xStatusIndicator->end();
@@ -136,16 +134,16 @@ BOOL PPMWriter::ImplWriteHeader()
if ( mnWidth && mnHeight )
{
if ( mnMode == 0 )
- *mpOStm << "P6\x0a";
+ m_rOStm << "P6\x0a";
else
- *mpOStm << "P3\x0a";
+ m_rOStm << "P3\x0a";
ImplWriteNumber( mnWidth );
- *mpOStm << (BYTE)32;
+ m_rOStm << (BYTE)32;
ImplWriteNumber( mnHeight );
- *mpOStm << (BYTE)32;
+ m_rOStm << (BYTE)32;
ImplWriteNumber( 255 ); // max. col.
- *mpOStm << (BYTE)10;
+ m_rOStm << (BYTE)10;
}
else
mbStatus = FALSE;
@@ -164,9 +162,9 @@ void PPMWriter::ImplWriteBody()
for ( ULONG x = 0; x < mnWidth; x++ )
{
const BitmapColor& rColor = mpAcc->GetPixel( y, x );
- *mpOStm << rColor.GetRed();
- *mpOStm << rColor.GetGreen();
- *mpOStm << rColor.GetBlue();
+ m_rOStm << rColor.GetRed();
+ m_rOStm << rColor.GetGreen();
+ m_rOStm << rColor.GetBlue();
}
}
}
@@ -181,7 +179,7 @@ void PPMWriter::ImplWriteBody()
if ( nCount < 0 )
{
nCount = 69;
- *mpOStm << (BYTE)10;
+ m_rOStm << (BYTE)10;
}
nDat[0] = mpAcc->GetPixel( y, x ).GetRed();
nDat[1] = mpAcc->GetPixel( y, x ).GetGreen();
@@ -191,12 +189,12 @@ void PPMWriter::ImplWriteBody()
nNumb = nDat[ i ] / 100;
if ( nNumb )
{
- *mpOStm << (BYTE)( nNumb + '0' );
+ m_rOStm << (BYTE)( nNumb + '0' );
nDat[ i ] -= ( nNumb * 100 );
nNumb = nDat[ i ] / 10;
- *mpOStm << (BYTE)( nNumb + '0' );
+ m_rOStm << (BYTE)( nNumb + '0' );
nDat[ i ] -= ( nNumb * 10 );
- *mpOStm << (BYTE)( nDat[ i ] + '0' );
+ m_rOStm << (BYTE)( nDat[ i ] + '0' );
nCount -= 4;
}
else
@@ -204,21 +202,21 @@ void PPMWriter::ImplWriteBody()
nNumb = nDat[ i ] / 10;
if ( nNumb )
{
- *mpOStm << (BYTE)( nNumb + '0' );
+ m_rOStm << (BYTE)( nNumb + '0' );
nDat[ i ] -= ( nNumb * 10 );
- *mpOStm << (BYTE)( nDat[ i ] + '0' );
+ m_rOStm << (BYTE)( nDat[ i ] + '0' );
nCount -= 3;
}
else
{
- *mpOStm << (BYTE)( nDat[ i ] + '0' );
+ m_rOStm << (BYTE)( nDat[ i ] + '0' );
nCount -= 2;
}
}
- *mpOStm << (BYTE)' ';
+ m_rOStm << (BYTE)' ';
}
}
- *mpOStm << (BYTE)10;
+ m_rOStm << (BYTE)10;
}
}
}
@@ -231,7 +229,7 @@ void PPMWriter::ImplWriteNumber( sal_Int32 nNumber )
const ByteString aNum( ByteString::CreateFromInt32( nNumber ) );
for( sal_Int16 n = 0, nLen = aNum.Len(); n < nLen; n++ )
- *mpOStm << aNum.GetChar( n );
+ m_rOStm << aNum.GetChar( n );
}
@@ -243,8 +241,8 @@ void PPMWriter::ImplWriteNumber( sal_Int32 nNumber )
extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL )
{
- PPMWriter aPPMWriter;
- return aPPMWriter.WritePPM( rGraphic, rStream, pFilterConfigItem );
+ PPMWriter aPPMWriter(rStream);
+ return aPPMWriter.WritePPM( rGraphic, pFilterConfigItem );
}
// ------------------------------------------------------------------------
More information about the Libreoffice-commits
mailing list