Skip to content

Commit eb3cee1

Browse files
committed
Fix incorrect values returned by certain color ramps
(cherry-picked from 27ee8ee)
1 parent 5d3382a commit eb3cee1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/symbology-ng/qgsvectorcolorrampv2.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ QgsVectorColorRampV2* QgsVectorRandomColorRampV2::create( const QgsStringMap& pr
291291
double QgsVectorRandomColorRampV2::value( int index ) const
292292
{
293293
if ( mColors.size() < 1 ) return 0;
294-
return index / mColors.size() - 1;
294+
return ( double )index / ( mColors.size() - 1 );
295295
}
296296

297297
QColor QgsVectorRandomColorRampV2::color( double value ) const
@@ -489,7 +489,7 @@ QList<int> QgsVectorColorBrewerColorRampV2::listSchemeVariants( QString schemeNa
489489
double QgsVectorColorBrewerColorRampV2::value( int index ) const
490490
{
491491
if ( mPalette.size() < 1 ) return 0;
492-
return index / mPalette.size() - 1;
492+
return ( double )index / ( mPalette.size() - 1 );
493493
}
494494

495495
QColor QgsVectorColorBrewerColorRampV2::color( double value ) const

0 commit comments

Comments
 (0)