ソースを参照

r.colors: fix order of rules (#2167)

The order of rules was reversed if scale and/or offset were needed.
Markus Metz 3 年 前
コミット
150a0e9242
1 ファイル変更3 行追加1 行削除
  1. 3 1
      raster/r.colors/rules.c

+ 3 - 1
raster/r.colors/rules.c

@@ -123,7 +123,9 @@ void rescale_colors(struct Colors *colors_tmp, struct Colors *colors,
     Rast_set_null_value_color(red, grn, blu, colors_tmp);
     Rast_set_null_value_color(red, grn, blu, colors_tmp);
 
 
     rcount = Rast_colors_count(colors);
     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,
 	Rast_get_fp_color_rule(&dmin, &r1, &g1, &b1,
 			       &dmax, &r2, &g2, &b2,
 			       &dmax, &r2, &g2, &b2,