Skip to content

Commit

Permalink
r.colors: fix order of rules (#2167)
Browse files Browse the repository at this point in the history
The order of rules was reversed if scale and/or offset were needed.
  • Loading branch information
metzm authored and neteler committed Feb 7, 2022
1 parent 28afe70 commit 8de5387
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion raster/r.colors/rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ void rescale_colors(struct Colors *colors_tmp, struct Colors *colors,
Rast_set_null_value_color(red, grn, blu, colors_tmp);

rcount = Rast_colors_count(colors);
for (i = 0; i < rcount; i++) {
/* read the rules in reverse order,
* see lib/raster/color_write.c:write_rules() */
for (i = rcount - 1; i >= 0; i--) {

Rast_get_fp_color_rule(&dmin, &r1, &g1, &b1,
&dmax, &r2, &g2, &b2,
Expand Down

0 comments on commit 8de5387

Please sign in to comment.