Skip to content
Permalink
Browse files

Fix image format conversion (used e.g. for WMS client) and two memory…

… leaks
  • Loading branch information
mhugent committed Oct 19, 2012
1 parent 6461a01 commit 7e5435cb90437e45525f035670661c90fcb42bb9
Showing with 3 additions and 5 deletions.
  1. +2 −5 src/core/raster/qgsrasterblock.cpp
  2. +1 −0 src/core/raster/qgsrasterprojector.cpp
@@ -54,7 +54,7 @@ QgsRasterBlock::QgsRasterBlock( DataType theDataType, int theWidth, int theHeigh
QgsRasterBlock::~QgsRasterBlock()
{
QgsFree( mData );

delete mImage;
}

bool QgsRasterBlock::reset( DataType theDataType, int theWidth, int theHeight, double theNoDataValue )
@@ -416,12 +416,9 @@ bool QgsRasterBlock::convert( QgsRasterBlock::DataType destDataType )
}
else if ( typeIsColor( mDataType ) && typeIsColor( destDataType ) )
{
// It would be probably faster to convert value by value here instead of
// creating new image, QImage (4.8) does not have any method to convert in place
QImage::Format format = imageFormat( destDataType );
QImage image = mImage->convertToFormat( format );
memcpy( mImage->bits(), image.bits(), mImage->byteCount() );
//mImage = new QImage( mWidth, mHeight, format );
*mImage = image;
}
else
{
@@ -708,6 +708,7 @@ QgsRasterBlock * QgsRasterProjector::block( int bandNo, QgsRectangle const & ex
if ( ! mSrcCRS.isValid() || ! mDestCRS.isValid() || mSrcCRS == mDestCRS )
{
QgsDebugMsg( "No projection necessary" );
delete outputBlock;
return mInput->block( bandNo, extent, width, height );
}

0 comments on commit 7e5435c

Please sign in to comment.
You can’t perform that action at this time.