[GRASS-SVN] r73046 - grass/branches/releasebranch_7_4/raster/r.what

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 3 14:52:23 PDT 2018


Author: mmetz
Date: 2018-08-03 14:52:23 -0700 (Fri, 03 Aug 2018)
New Revision: 73046

Modified:
   grass/branches/releasebranch_7_4/raster/r.what/main.c
Log:
r.what: fix if coords are just outside current region (backport trunk r73000)

Modified: grass/branches/releasebranch_7_4/raster/r.what/main.c
===================================================================
--- grass/branches/releasebranch_7_4/raster/r.what/main.c	2018-08-03 21:50:23 UTC (rev 73045)
+++ grass/branches/releasebranch_7_4/raster/r.what/main.c	2018-08-03 21:52:23 UTC (rev 73046)
@@ -368,11 +368,16 @@
 			 *   the point will appear outside the window.
 			 *   So, for these edges, bring the point inside the window
 			 */
-			if (drow == window.rows)
-			    drow--;
-			if (dcol == window.cols)
-			    dcol--;
+			if (north == window.south)
+			    drow = window.rows - 1;
+			if (east == window.east)
+			    dcol = window.cols - 1;
 
+			if (drow < 0)
+			    drow = -1;
+			if (dcol < 0)
+			    dcol = -1;
+
 			if (!done) {
 			    cache[point_cnt].row = (int)drow;
 			    cache[point_cnt].col = (int)dcol;



More information about the grass-commit mailing list