Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix overflow in elevation map
  • Loading branch information
nyalldawson committed Apr 17, 2023
1 parent 9474248 commit f28ba2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/qgselevationmap.cpp
Expand Up @@ -46,7 +46,7 @@ QRgb QgsElevationMap::encodeElevation( float z )
{
double zScaled = ( z + ELEVATION_OFFSET ) * ELEVATION_SCALE;
unsigned int zInt = static_cast<unsigned int>( std::clamp( zScaled, 0., 16777215. ) ); // make sure to fit into 3 bytes
return QRgb( zInt | ( 0xff << 24 ) );
return QRgb( zInt | ( static_cast< unsigned int >( 0xff ) << 24 ) );
}

float QgsElevationMap::decodeElevation( QRgb colorRaw )
Expand Down

0 comments on commit f28ba2b

Please sign in to comment.