Skip to content

Commit 8872fcb

Browse files
author
jef
committed
fix #2457
git-svn-id: http://svn.osgeo.org/qgis/trunk@13750 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 287a82d commit 8872fcb

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/core/raster/qgsrasterlayer.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4507,7 +4507,9 @@ void QgsRasterLayer::drawPalettedSingleBandColor( QPainter * theQPainter, QgsRas
45074507
{
45084508
for ( int i = 0; i < theRasterViewPort->drawableAreaXDim; ++i )
45094509
{
4510-
myRedValue = 0; myGreenValue = 0; myBlueValue = 0;
4510+
myRedValue = 0;
4511+
myGreenValue = 0;
4512+
myBlueValue = 0;
45114513
myPixelValue = readValue( rasterScanLine, ( GDALDataType )myDataType, i );
45124514

45134515
if ( mValidNoDataValue && ( fabs( myPixelValue - mNoDataValue ) <= TINY_VALUE || myPixelValue != myPixelValue ) )
@@ -5404,7 +5406,8 @@ bool QgsRasterLayer::readFile( QString const &theFilename )
54045406
*/
54055407
double QgsRasterLayer::readValue( void *data, GDALDataType type, int index )
54065408
{
5407-
double val;
5409+
if ( !data )
5410+
return mValidNoDataValue ? mNoDataValue : 0.0;
54085411

54095412
switch ( type )
54105413
{
@@ -5427,13 +5430,13 @@ double QgsRasterLayer::readValue( void *data, GDALDataType type, int index )
54275430
return ( double )(( float * )data )[index];
54285431
break;
54295432
case GDT_Float64:
5430-
val = (( double * )data )[index];
54315433
return ( double )(( double * )data )[index];
54325434
break;
54335435
default:
54345436
QgsLogger::warning( "GDAL data type is not supported" );
54355437
}
5436-
return 0.0;
5438+
5439+
return mValidNoDataValue ? mNoDataValue : 0.0;
54375440
}
54385441

54395442
bool QgsRasterLayer::update()
@@ -5599,7 +5602,7 @@ bool QgsRasterImageBuffer::nextScanLine( QRgb** imageScanLine, void** rasterScan
55995602

56005603
++mCurrentPartImageRow;
56015604
++mCurrentRow;
5602-
return true;
5605+
return !mWritingEnabled || *imageScanLine;
56035606
}
56045607

56055608
bool QgsRasterImageBuffer::createNextPartImage()

src/core/raster/qgsrasterlayer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
email : tim@linfiniti.com
77
***************************************************************************/
88
/*
9-
* Peter J. Ersts - contirbuted to the refactoring and maintenance of this class
9+
* Peter J. Ersts - contributed to the refactoring and maintenance of this class
1010
* B. Morley - added functions to convert this class to a data provider interface
1111
* Frank Warmerdam - contributed bug fixes and migrated class to use all GDAL_C_API calls
1212
*/

0 commit comments

Comments
 (0)