[QGIS Commit] r15736 - trunk/qgis/src/core/raster

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Apr 16 16:34:48 EDT 2011


Author: mhugent
Date: 2011-04-16 13:34:48 -0700 (Sat, 16 Apr 2011)
New Revision: 15736

Modified:
   trunk/qgis/src/core/raster/qgsrasterlayer.cpp
Log:
Improve raster performance if no clip and stretch is used on multi band color layer

Modified: trunk/qgis/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2011-04-16 19:03:21 UTC (rev 15735)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2011-04-16 20:34:48 UTC (rev 15736)
@@ -3771,7 +3771,6 @@
   {
     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 @@
         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 @@
         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 )
       {



More information about the QGIS-commit mailing list