Skip to content
Permalink
Browse files

Rewrite pseudocolor render code to improve speed

Most of the time was lost in checking the color cache, so that is replaced
by a look up table for the index in the color map.
  • Loading branch information
pierstitus committed Apr 20, 2016
1 parent 9a161ac commit 208a14eb549a3df283b663209207a60889124a6d
Showing with 160 additions and 235 deletions.
  1. +10 −5 python/core/raster/qgscolorrampshader.sip
  2. +129 −200 src/core/raster/qgscolorrampshader.cpp
  3. +21 −30 src/core/raster/qgscolorrampshader.h
@@ -26,11 +26,12 @@ class QgsColorRampShader : QgsRasterShaderFunction
bool operator<( const QgsColorRampShader::ColorRampItem& other ) const;
};

/** Supported methods for color interpolation. */
enum ColorRamp_TYPE
{
INTERPOLATED,
DISCRETE,
EXACT
INTERPOLATED, //!< Interpolates the color between two class breaks linearly.
DISCRETE, //!< Assigns the color of the higher class for every pixel between two class breaks.
EXACT //!< Assigns the color of the exact matching value in the color ramp item list
};

/** \brief Get the custom colormap*/
@@ -42,7 +43,9 @@ class QgsColorRampShader : QgsRasterShaderFunction
/** \brief Get the color ramp type as a string */
QString colorRampTypeAsQString();

/** \brief Get the maximum size the color cache can be*/
/** \brief Get the maximum size the color cache can be
* @deprecated will be removed in QGIS 3.0. Color cache is not used anymore.
*/
int maximumColorCacheSize();

/** \brief Set custom colormap */
@@ -54,7 +57,9 @@ class QgsColorRampShader : QgsRasterShaderFunction
/** \brief Set the color ramp type*/
void setColorRampType( const QString& theType );

/** \brief Set the maximum size the color cache can be */
/** \brief Set the maximum size the color cache can be
* @deprecated will be removed in QGIS 3.0. Color cache is not used anymore.
*/
void setMaximumColorCacheSize( int theSize );

/** \brief Generates and new RGB value based on one input value */

0 comments on commit 208a14e

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