Skip to content
Permalink
Browse files

Make shade() const

  • Loading branch information
wonder-sk committed Jul 12, 2018
1 parent 39ac58b commit 48195e01582b92cb00cb7676c7b33d5a6441fefa
@@ -143,7 +143,7 @@ Classify color ramp shader
:param input: raster input used in classification (quantile mode only)
%End

virtual bool shade( double value, int *returnRedValue /Out/, int *returnGreenValue /Out/, int *returnBlueValue /Out/, int *returnAlphaValue /Out/ );
virtual bool shade( double value, int *returnRedValue /Out/, int *returnGreenValue /Out/, int *returnBlueValue /Out/, int *returnAlphaValue /Out/ ) const;

%Docstring
Generates and new RGB value based on one input value
@@ -152,7 +152,7 @@ Generates and new RGB value based on one input value
virtual bool shade( double redValue, double greenValue,
double blueValue, double alphaValue,
int *returnRedValue /Out/, int *returnGreenValue /Out/,
int *returnBlueValue /Out/, int *returnAlphaValue /Out/ );
int *returnBlueValue /Out/, int *returnAlphaValue /Out/ ) const;
%Docstring
Generates and new RGB value based on original RGB value
%End
@@ -54,7 +54,7 @@ Sets the minimum ``value`` for the raster shader.
int *returnRedValue /Out/,
int *returnGreenValue /Out/,
int *returnBlueValue /Out/,
int *returnAlpha /Out/ );
int *returnAlpha /Out/ ) const;
%Docstring
Generates an new RGBA value based on one input ``value``.

@@ -74,7 +74,7 @@ Generates an new RGBA value based on one input ``value``.
int *returnRedValue /Out/,
int *returnGreenValue /Out/,
int *returnBlueValue /Out/,
int *returnAlpha /Out/ );
int *returnAlpha /Out/ ) const;
%Docstring
Generates an new RGBA value based on an original RGBA value.

@@ -315,7 +315,7 @@ void QgsColorRampShader::classifyColorRamp( const int band, const QgsRectangle &
classifyColorRamp( colorRampItemList().count(), band, extent, input );
}

bool QgsColorRampShader::shade( double value, int *returnRedValue, int *returnGreenValue, int *returnBlueValue, int *returnAlphaValue )
bool QgsColorRampShader::shade( double value, int *returnRedValue, int *returnGreenValue, int *returnBlueValue, int *returnAlphaValue ) const
{
if ( mColorRampItemList.isEmpty() )
{
@@ -464,7 +464,7 @@ bool QgsColorRampShader::shade( double value, int *returnRedValue, int *returnGr
bool QgsColorRampShader::shade( double redValue, double greenValue,
double blueValue, double alphaValue,
int *returnRedValue, int *returnGreenValue,
int *returnBlueValue, int *returnAlphaValue )
int *returnBlueValue, int *returnAlphaValue ) const
{
Q_UNUSED( redValue );
Q_UNUSED( greenValue );
@@ -157,13 +157,13 @@ class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction
void classifyColorRamp( int band = -1, const QgsRectangle &extent = QgsRectangle(), QgsRasterInterface *input = nullptr ) SIP_PYNAME( classifyColorRampV2 );

//! \brief Generates and new RGB value based on one input value
bool shade( double value, int *returnRedValue SIP_OUT, int *returnGreenValue SIP_OUT, int *returnBlueValue SIP_OUT, int *returnAlphaValue SIP_OUT ) override;
bool shade( double value, int *returnRedValue SIP_OUT, int *returnGreenValue SIP_OUT, int *returnBlueValue SIP_OUT, int *returnAlphaValue SIP_OUT ) const override;

//! \brief Generates and new RGB value based on original RGB value
bool shade( double redValue, double greenValue,
double blueValue, double alphaValue,
int *returnRedValue SIP_OUT, int *returnGreenValue SIP_OUT,
int *returnBlueValue SIP_OUT, int *returnAlphaValue SIP_OUT ) override;
int *returnBlueValue SIP_OUT, int *returnAlphaValue SIP_OUT ) const override;

void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems SIP_OUT ) const override;

@@ -207,10 +207,10 @@ class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction
/**
* Look up table to speed up finding the right color.
* It is initialized on the first call to shade(). */
QVector<int> mLUT;
double mLUTOffset = 0.0;
double mLUTFactor = 1.0;
bool mLUTInitialized = false;
mutable QVector<int> mLUT;
mutable double mLUTOffset = 0.0;
mutable double mLUTFactor = 1.0;
mutable bool mLUTInitialized = false;

//! Do not render values out of range
bool mClip = false;
@@ -43,7 +43,7 @@ void QgsRasterShaderFunction::setMinimumValue( double value )
mMinimumMaximumRange = mMaximumValue - mMinimumValue;
}

bool QgsRasterShaderFunction::shade( double value, int *returnRedValue, int *returnGreenValue, int *returnBlueValue, int *returnAlphaValue )
bool QgsRasterShaderFunction::shade( double value, int *returnRedValue, int *returnGreenValue, int *returnBlueValue, int *returnAlphaValue ) const
{
Q_UNUSED( value );

@@ -55,7 +55,7 @@ bool QgsRasterShaderFunction::shade( double value, int *returnRedValue, int *ret
return false;
}

bool QgsRasterShaderFunction::shade( double redValue, double greenValue, double blueValue, double alphaValue, int *returnRedValue, int *returnGreenValue, int *returnBlueValue, int *returnAlphaValue )
bool QgsRasterShaderFunction::shade( double redValue, double greenValue, double blueValue, double alphaValue, int *returnRedValue, int *returnGreenValue, int *returnBlueValue, int *returnAlphaValue ) const
{
Q_UNUSED( redValue );
Q_UNUSED( greenValue );
@@ -78,7 +78,7 @@ class CORE_EXPORT QgsRasterShaderFunction
int *returnRedValue SIP_OUT,
int *returnGreenValue SIP_OUT,
int *returnBlueValue SIP_OUT,
int *returnAlpha SIP_OUT );
int *returnAlpha SIP_OUT ) const;

/**
* Generates an new RGBA value based on an original RGBA value.
@@ -100,7 +100,7 @@ class CORE_EXPORT QgsRasterShaderFunction
int *returnRedValue SIP_OUT,
int *returnGreenValue SIP_OUT,
int *returnBlueValue SIP_OUT,
int *returnAlpha SIP_OUT );
int *returnAlpha SIP_OUT ) const;

double minimumMaximumRange() const { return mMinimumMaximumRange; }

@@ -235,7 +235,7 @@ QgsRasterBlock *QgsSingleBandPseudoColorRenderer::block( int bandNo, QgsRectangl

QRgb myDefaultColor = NODATA_COLOR;
QRgb *outputBlockData = outputBlock->colorData();
QgsRasterShaderFunction *fcn = const_cast<QgsRasterShaderFunction *>( mShader->rasterShaderFunction() );
const QgsRasterShaderFunction *fcn = mShader->rasterShaderFunction();

qgssize count = ( qgssize )width * height;
for ( qgssize i = 0; i < count; i++ )

0 comments on commit 48195e0

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