Skip to content

Commit

Permalink
Fix raster layers not rendering on Windows 8
Browse files Browse the repository at this point in the history
The copy constructor for QgsContrastEnhancement was using
an uninitialized value for the mContrastEnhancementAlgorithm
member, resulting in no contrast function being set in
certain occasions.

Refs #13155

(cherry-picked from cc50542)
  • Loading branch information
nyalldawson committed Feb 23, 2016
1 parent 78cb79b commit 4433020
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions src/core/raster/qgscontrastenhancement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,34 +271,31 @@ void QgsContrastEnhancement::setContrastEnhancementAlgorithm( ContrastEnhancemen
{
QgsDebugMsg( "called algorithm: " + QString::number(( int )theAlgorithm ) + " generate lookup table: " + QString::number(( int )generateTable ) );

if ( theAlgorithm != mContrastEnhancementAlgorithm )
switch ( theAlgorithm )
{
switch ( theAlgorithm )
{
case StretchToMinimumMaximum :
mContrastEnhancementFunction = new QgsLinearMinMaxEnhancement( mRasterDataType, mMinimumValue, mMaximumValue );
break;
case StretchAndClipToMinimumMaximum :
mContrastEnhancementFunction = new QgsLinearMinMaxEnhancementWithClip( mRasterDataType, mMinimumValue, mMaximumValue );
break;
case ClipToMinimumMaximum :
mContrastEnhancementFunction = new QgsClipToMinMaxEnhancement( mRasterDataType, mMinimumValue, mMaximumValue );
break;
case UserDefinedEnhancement :
//Do nothing
break;
default:
mContrastEnhancementFunction = new QgsContrastEnhancementFunction( mRasterDataType, mMinimumValue, mMaximumValue );
break;
}
case StretchToMinimumMaximum :
mContrastEnhancementFunction = new QgsLinearMinMaxEnhancement( mRasterDataType, mMinimumValue, mMaximumValue );
break;
case StretchAndClipToMinimumMaximum :
mContrastEnhancementFunction = new QgsLinearMinMaxEnhancementWithClip( mRasterDataType, mMinimumValue, mMaximumValue );
break;
case ClipToMinimumMaximum :
mContrastEnhancementFunction = new QgsClipToMinMaxEnhancement( mRasterDataType, mMinimumValue, mMaximumValue );
break;
case UserDefinedEnhancement :
//Do nothing
break;
default:
mContrastEnhancementFunction = new QgsContrastEnhancementFunction( mRasterDataType, mMinimumValue, mMaximumValue );
break;
}

mEnhancementDirty = true;
mContrastEnhancementAlgorithm = theAlgorithm;
mEnhancementDirty = true;
mContrastEnhancementAlgorithm = theAlgorithm;

if ( generateTable )
{
generateLookupTable();
}
if ( generateTable )
{
generateLookupTable();
}
}

Expand Down

0 comments on commit 4433020

Please sign in to comment.