summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-05-21 14:30:40 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-05-21 15:30:18 +0200
commit46d442860a1252f7260c97b1f629ce8e77f72a3a (patch)
treeaf483aa4448085f51e2c187aa802e2bf1ab359e0 /vcl
parent2993c7c0000d32933bc7ca7fabe975a91b672edf (diff)
ZCodec instances can be allocated on the stack just fine
Change-Id: I4b185f9a0ecaa74ca3f1e93b3bfe504e9778a8ca
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/pngwrite.cxx33
1 files changed, 13 insertions, 20 deletions
diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx
index 9057a48221f6..9f35f0283bda 100644
--- a/vcl/source/gdi/pngwrite.cxx
+++ b/vcl/source/gdi/pngwrite.cxx
@@ -49,7 +49,6 @@ public:
PNGWriterImpl( const BitmapEx& BmpEx,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData = NULL );
- ~PNGWriterImpl();
bool Write( SvStream& rOStm );
@@ -66,7 +65,7 @@ private:
BitmapReadAccess* mpAccess;
BitmapReadAccess* mpMaskAccess;
- ZCodec* mpZCodec;
+ ZCodec mpZCodec;
sal_uInt8* mpDeflateInBuf; // as big as the size of a scanline + alphachannel + 1
sal_uInt8* mpPreviousScan; // as big as mpDeflateInBuf
@@ -102,7 +101,6 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx,
, mbStatus(true)
, mpAccess(NULL)
, mpMaskAccess(NULL)
- , mpZCodec(new ZCodec)
, mpDeflateInBuf(NULL)
, mpPreviousScan(NULL)
, mpCurrentScan(NULL)
@@ -240,11 +238,6 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx,
}
}
-PNGWriterImpl::~PNGWriterImpl()
-{
- delete mpZCodec;
-}
-
bool PNGWriterImpl::Write( SvStream& rOStm )
{
/* png signature is always an array of 8 bytes */
@@ -386,56 +379,56 @@ void PNGWriterImpl::ImplWriteIDAT ()
mpCurrentScan = new sal_uInt8[ mnDeflateInSize ];
ImplClearFirstScanline();
}
- mpZCodec->BeginCompression( mnCompLevel, true );
- mpZCodec->SetCRC( mnCRC );
+ mpZCodec.BeginCompression( mnCompLevel, true );
+ mpZCodec.SetCRC( mnCRC );
SvMemoryStream aOStm;
if ( mnInterlaced == 0 )
{
for ( sal_uLong nY = 0; nY < mnHeight; nY++ )
- mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter( nY ) );
+ mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter( nY ) );
}
else
{
// interlace mode
sal_uLong nY;
for ( nY = 0; nY < mnHeight; nY+=8 ) // pass 1
- mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 8 ) );
+ mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 8 ) );
ImplClearFirstScanline();
for ( nY = 0; nY < mnHeight; nY+=8 ) // pass 2
- mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 4, 8 ) );
+ mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 4, 8 ) );
ImplClearFirstScanline();
if ( mnHeight >= 5 ) // pass 3
{
for ( nY = 4; nY < mnHeight; nY+=8 )
- mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 4 ) );
+ mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 4 ) );
ImplClearFirstScanline();
}
for ( nY = 0; nY < mnHeight; nY+=4 ) // pass 4
- mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 2, 4 ) );
+ mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 2, 4 ) );
ImplClearFirstScanline();
if ( mnHeight >= 3 ) // pass 5
{
for ( nY = 2; nY < mnHeight; nY+=4 )
- mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 2 ) );
+ mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 2 ) );
ImplClearFirstScanline();
}
for ( nY = 0; nY < mnHeight; nY+=2 ) // pass 6
- mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 1, 2 ) );
+ mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 1, 2 ) );
ImplClearFirstScanline();
if ( mnHeight >= 2 ) // pass 7
{
for ( nY = 1; nY < mnHeight; nY+=2 )
- mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 1 ) );
+ mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 1 ) );
}
}
- mpZCodec->EndCompression();
- mnCRC = mpZCodec->GetCRC();
+ mpZCodec.EndCompression();
+ mnCRC = mpZCodec.GetCRC();
if ( mnFilterType ) // using filter type 4 we need memory for the scanline 3 times
{