소스 검색

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);
 
     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,