Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix #2457
git-svn-id: http://svn.osgeo.org/qgis/trunk@13750 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jun 19, 2010
1 parent 287a82d commit 8872fcb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/core/raster/qgsrasterlayer.cpp
Expand Up @@ -4507,7 +4507,9 @@ void QgsRasterLayer::drawPalettedSingleBandColor( QPainter * theQPainter, QgsRas
{
for ( int i = 0; i < theRasterViewPort->drawableAreaXDim; ++i )
{
myRedValue = 0; myGreenValue = 0; myBlueValue = 0;
myRedValue = 0;
myGreenValue = 0;
myBlueValue = 0;
myPixelValue = readValue( rasterScanLine, ( GDALDataType )myDataType, i );

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

switch ( type )
{
Expand All @@ -5427,13 +5430,13 @@ double QgsRasterLayer::readValue( void *data, GDALDataType type, int index )
return ( double )(( float * )data )[index];
break;
case GDT_Float64:
val = (( double * )data )[index];
return ( double )(( double * )data )[index];
break;
default:
QgsLogger::warning( "GDAL data type is not supported" );
}
return 0.0;

return mValidNoDataValue ? mNoDataValue : 0.0;
}

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

++mCurrentPartImageRow;
++mCurrentRow;
return true;
return !mWritingEnabled || *imageScanLine;
}

bool QgsRasterImageBuffer::createNextPartImage()
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsrasterlayer.h
Expand Up @@ -6,7 +6,7 @@
email : tim@linfiniti.com
***************************************************************************/
/*
* Peter J. Ersts - contirbuted to the refactoring and maintenance of this class
* Peter J. Ersts - contributed to the refactoring and maintenance of this class
* B. Morley - added functions to convert this class to a data provider interface
* Frank Warmerdam - contributed bug fixes and migrated class to use all GDAL_C_API calls
*/
Expand Down

0 comments on commit 8872fcb

Please sign in to comment.