diff options
author | Mark Kriegsman <kriegsman@tr.org> | 2014-11-25 20:31:58 +0300 |
---|---|---|
committer | Mark Kriegsman <kriegsman@tr.org> | 2014-11-25 20:31:58 +0300 |
commit | 07a5834c65ecd78cdef5d32b5b43d9c7b767b8d1 (patch) | |
tree | dc17d7c9690c078975f10ed1dee2e14b4150a819 | |
parent | 727022725a959162229badd58c8050ac92827a95 (diff) |
Fix off-by-one error in array blend functions.
-rw-r--r-- | colorutils.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/colorutils.cpp b/colorutils.cpp index bac21851..9e5808fc 100644 --- a/colorutils.cpp +++ b/colorutils.cpp @@ -267,7 +267,7 @@ CRGB blend( const CRGB& p1, const CRGB& p2, fract8 amountOfP2 ) CRGB* blend( const CRGB* src1, const CRGB* src2, CRGB* dest, uint16_t count, fract8 amountOfsrc2 ) { - for( uint16_t i = count; i; i--) { + for( uint16_t i = 0; i < count; i++) { dest[i] = blend(src1[i], src2[i], amountOfsrc2); } return dest; @@ -343,7 +343,7 @@ CHSV blend( const CHSV& p1, const CHSV& p2, fract8 amountOfP2, TGradientDirectio CHSV* blend( const CHSV* src1, const CHSV* src2, CHSV* dest, uint16_t count, fract8 amountOfsrc2, TGradientDirectionCode directionCode ) { - for( uint16_t i = count; i; i--) { + for( uint16_t i = 0; i < count; i++) { dest[i] = blend(src1[i], src2[i], amountOfsrc2, directionCode); } return dest; |