Skip to content

Commit

Permalink
Fix incorrect values returned by certain color ramps
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 4, 2015
1 parent c31810a commit 27ee8ee
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 @@ -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 27ee8ee

Please sign in to comment.