Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix incorrect values returned by certain color ramps
(cherry-picked from 27ee8ee)
  • Loading branch information
nyalldawson committed Aug 4, 2015
1 parent 5d3382a commit eb3cee1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgsvectorcolorrampv2.cpp
Expand Up @@ -291,7 +291,7 @@ QgsVectorColorRampV2* QgsVectorRandomColorRampV2::create( const QgsStringMap& pr
double QgsVectorRandomColorRampV2::value( int index ) const
{
if ( mColors.size() < 1 ) return 0;
return index / mColors.size() - 1;
return ( double )index / ( mColors.size() - 1 );
}

QColor QgsVectorRandomColorRampV2::color( double value ) const
Expand Down Expand Up @@ -489,7 +489,7 @@ QList<int> QgsVectorColorBrewerColorRampV2::listSchemeVariants( QString schemeNa
double QgsVectorColorBrewerColorRampV2::value( int index ) const
{
if ( mPalette.size() < 1 ) return 0;
return index / mPalette.size() - 1;
return ( double )index / ( mPalette.size() - 1 );
}

QColor QgsVectorColorBrewerColorRampV2::color( double value ) const
Expand Down

0 comments on commit eb3cee1

Please sign in to comment.