Skip to content
Permalink
Browse files
Improve raster performance if no clip and stretch is used on multi ba…
…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 a8ac741972860b72690b76b27cd95dddef03abfd
Showing with 16 additions and 7 deletions.
  1. +16 −7 src/core/raster/qgsrasterlayer.cpp
@@ -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 );
@@ -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;
@@ -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 )
{

0 comments on commit a8ac741

Please sign in to comment.