Skip to content

Commit

Permalink
Fix incorrect values returned by certain color ramps
Browse files Browse the repository at this point in the history
(cherry-picked from 27ee8ee)
  • Loading branch information
nyalldawson committed Aug 4, 2015
1 parent 6be19a8 commit e54b7ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgsvectorcolorrampv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,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 @@ -487,7 +487,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 e54b7ae

Please sign in to comment.