[GRASS-SVN] r57791 - in grass/branches/releasebranch_6_4/imagery: i.his.rgb i.rgb.his

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 22 00:33:05 PDT 2013


Author: hamish
Date: 2013-09-22 00:33:04 -0700 (Sun, 22 Sep 2013)
New Revision: 57791

Modified:
   grass/branches/releasebranch_6_4/imagery/i.his.rgb/h2rmain.c
   grass/branches/releasebranch_6_4/imagery/i.his.rgb/his2rgb.c
   grass/branches/releasebranch_6_4/imagery/i.rgb.his/r2hmain.c
   grass/branches/releasebranch_6_4/imagery/i.rgb.his/rgb2his.c
Log:
add NULL support (merge r52208 from devbr6)

Modified: grass/branches/releasebranch_6_4/imagery/i.his.rgb/h2rmain.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.his.rgb/h2rmain.c	2013-09-22 07:28:09 UTC (rev 57790)
+++ grass/branches/releasebranch_6_4/imagery/i.his.rgb/h2rmain.c	2013-09-22 07:33:04 UTC (rev 57791)
@@ -91,7 +91,7 @@
 
 	/* read in a row from each cell map */
 	for (band = 0; band < 3; band++)
-	    if (G_get_map_row(fd_input[band], rowbuffer[band], i) < 0)
+	    if (G_get_c_raster_row(fd_input[band], rowbuffer[band], i) < 0)
 		G_fatal_error(_("Unable to read raster map row %ld"), i);
 
 	/* process this row of the map */

Modified: grass/branches/releasebranch_6_4/imagery/i.his.rgb/his2rgb.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.his.rgb/his2rgb.c	2013-09-22 07:28:09 UTC (rev 57790)
+++ grass/branches/releasebranch_6_4/imagery/i.his.rgb/his2rgb.c	2013-09-22 07:33:04 UTC (rev 57791)
@@ -37,6 +37,15 @@
 
 
     for (sample = 0; sample < columns; sample++) {
+	if (G_is_c_null_value(&rowbuffer[0][sample]) ||
+	    G_is_c_null_value(&rowbuffer[1][sample]) ||
+	    G_is_c_null_value(&rowbuffer[2][sample])) {
+	    G_set_c_null_value(&rowbuffer[0][sample], 1);
+	    G_set_c_null_value(&rowbuffer[1][sample], 1);
+	    G_set_c_null_value(&rowbuffer[2][sample], 1);
+	    continue;
+	}
+
 	red = green = blue = 0.0;
 	scalei = (double)rowbuffer[1][sample];
 	scalei /= 255.;

Modified: grass/branches/releasebranch_6_4/imagery/i.rgb.his/r2hmain.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.rgb.his/r2hmain.c	2013-09-22 07:28:09 UTC (rev 57790)
+++ grass/branches/releasebranch_6_4/imagery/i.rgb.his/r2hmain.c	2013-09-22 07:33:04 UTC (rev 57791)
@@ -89,7 +89,7 @@
 	G_percent(i, rows, 2);
 
 	for (band = 0; band < 3; band++)
-	    if (G_get_map_row(fd_input[band], rowbuffer[band], i) < 0)
+	    if (G_get_c_raster_row(fd_input[band], rowbuffer[band], i) < 0)
 		G_fatal_error(_("Unable to read raster map row %ld"), i);
 
 	/* process this row of the map */

Modified: grass/branches/releasebranch_6_4/imagery/i.rgb.his/rgb2his.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.rgb.his/rgb2his.c	2013-09-22 07:28:09 UTC (rev 57790)
+++ grass/branches/releasebranch_6_4/imagery/i.rgb.his/rgb2his.c	2013-09-22 07:33:04 UTC (rev 57791)
@@ -35,6 +35,15 @@
     double hue = 0.0L;		/* hue                                   */
 
     for (sample = 0; sample < columns; sample++) {
+	if (G_is_c_null_value(&rowbuffer[0][sample]) ||
+	    G_is_c_null_value(&rowbuffer[1][sample]) ||
+	    G_is_c_null_value(&rowbuffer[2][sample])) {
+	    G_set_c_null_value(&rowbuffer[0][sample], 1);
+	    G_set_c_null_value(&rowbuffer[1][sample], 1);
+	    G_set_c_null_value(&rowbuffer[2][sample], 1);
+	    continue;
+	}
+
 	scaler = (double)rowbuffer[0][sample];
 	scaler /= 255.0;
 	scaleg = (double)rowbuffer[1][sample];



More information about the grass-commit mailing list