Skip to content
Permalink
Browse files

Fix raster layers not rendering on Windows 8

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 44330203884ec0e76158be3f4cb5033bdd5ecd88
Showing with 22 additions and 25 deletions.
  1. +22 −25 src/core/raster/qgscontrastenhancement.cpp
@@ -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();
}
}

0 comments on commit 4433020

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