Skip to content

Commit

Permalink
Improve raster performance if no clip and stretch is used on multi ba…
Browse files Browse the repository at this point in the history
…nd color layer

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15736 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 16, 2011
1 parent 87460ac commit a8ac741
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/core/raster/qgsrasterlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3771,7 +3771,6 @@ void QgsRasterLayer::drawMultiBandColor( QPainter * theQPainter, QgsRasterViewPo
{
for ( int i = 0; i < theRasterViewPort->drawableAreaXDim; ++i )
{
//myRedValue = readValue( redRasterScanLine, ( GDALDataType )myRedType, i );
myRedValue = readValue( redRasterScanLine, myRedType, i );
myGreenValue = readValue( greenRasterScanLine, myGreenType, i );
myBlueValue = readValue( blueRasterScanLine, myBlueType, i );
Expand All @@ -3788,9 +3787,10 @@ void QgsRasterLayer::drawMultiBandColor( QPainter * theQPainter, QgsRasterViewPo
continue;
}

if ( !myRedContrastEnhancement->isValueInDisplayableRange( myRedValue ) ||
!myGreenContrastEnhancement->isValueInDisplayableRange( myGreenValue ) ||
!myBlueContrastEnhancement->isValueInDisplayableRange( myBlueValue ) )
if ( QgsContrastEnhancement::NoEnhancement != contrastEnhancementAlgorithm() &&
( !myRedContrastEnhancement->isValueInDisplayableRange( myRedValue ) ||
!myGreenContrastEnhancement->isValueInDisplayableRange( myGreenValue ) ||
!myBlueContrastEnhancement->isValueInDisplayableRange( myBlueValue ) ) )
{
redImageScanLine[ i ] = myDefaultColor;
continue;
Expand All @@ -3803,9 +3803,18 @@ void QgsRasterLayer::drawMultiBandColor( QPainter * theQPainter, QgsRasterViewPo
continue;
}

myStretchedRedValue = myRedContrastEnhancement->enhanceContrast( myRedValue );
myStretchedGreenValue = myGreenContrastEnhancement->enhanceContrast( myGreenValue );
myStretchedBlueValue = myBlueContrastEnhancement->enhanceContrast( myBlueValue );
if ( QgsContrastEnhancement::NoEnhancement == contrastEnhancementAlgorithm() )
{
myStretchedRedValue = myRedValue;
myStretchedGreenValue = myGreenValue;
myStretchedBlueValue = myBlueValue;
}
else
{
myStretchedRedValue = myRedContrastEnhancement->enhanceContrast( myRedValue );
myStretchedGreenValue = myGreenContrastEnhancement->enhanceContrast( myGreenValue );
myStretchedBlueValue = myBlueContrastEnhancement->enhanceContrast( myBlueValue );
}

if ( mInvertColor )
{
Expand Down

0 comments on commit a8ac741

Please sign in to comment.