summaryrefslogtreecommitdiffstats
path: root/libdimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-11-08 00:57:42 -0500
committerTavian Barnes <tavianator@gmail.com>2010-11-08 00:57:42 -0500
commit302450a001fdadf70c8ab304d97de89de7a989c2 (patch)
treee230aeabca20f55de4305e08759fc240cccc15c2 /libdimension
parent800cce2de40fe60185472cfb93c3a2201eea0b60 (diff)
downloaddimension-302450a001fdadf70c8ab304d97de89de7a989c2.tar.xz
Fix color_map values for negative parameters.
Diffstat (limited to 'libdimension')
-rw-r--r--libdimension/color_map.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libdimension/color_map.c b/libdimension/color_map.c
index 4832e87..f567db6 100644
--- a/libdimension/color_map.c
+++ b/libdimension/color_map.c
@@ -65,6 +65,10 @@ dmnsn_color_map_value(const dmnsn_color_map *map, double n)
double n1, n2 = 0.0;
dmnsn_color c1, c2 = entry->color;
+ if (n < n2) {
+ return c2;
+ }
+
for (; entry <= (dmnsn_color_map_entry *)dmnsn_array_last(map); ++entry) {
n1 = n2;
c1 = c2;