[DRE-maint] Bug#512033: Acknowledgement (libgruff-ruby: Repeats last color from defined set, resulting in the wrong output image)

Gunnar Wolf gwolf at gwolf.org
Fri Jan 16 16:21:49 UTC 2009


tags 512033 + patch, upstream
thanks

The following patch fixes the problem:
======================================================================
diff --git a/lib/gruff/base.rb b/lib/gruff/base.rb
index 553b7ee..49bd726 100644
--- a/lib/gruff/base.rb
+++ b/lib/gruff/base.rb
@@ -1036,19 +1036,8 @@ module Gruff
 
     # Uses the next color in your color list.
     def increment_color
-      if @color_index == 0
-        @color_index += 1
-        return @colors[0]
-      else
-        if @color_index < @colors.length
-          @color_index += 1
-          return @colors[@color_index - 1]
-        else
-          # Start over
-          @color_index = 0
-          return @colors[-1]
-        end
-      end
+      @color_index = (@color_index + 1) % @colors.length
+      return @colors[@color_index - 1]
     end
 
     # Return a formatted string representing a number value that
       should be
======================================================================

I will be uploading a patched version, and sending this report to the
upstream author.

-- 
Gunnar Wolf - gwolf at gwolf.org - (+52-55)5623-0154 / 1451-2244
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973  F800 D80E F35A 8BB5 27AF






More information about the Pkg-ruby-extras-maintainers mailing list