[GRASS-SVN] r29489 - in grass/trunk: display/d.save lib/display

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 20 20:22:18 EST 2007


Author: hamish
Date: 2007-12-20 20:22:17 -0500 (Thu, 20 Dec 2007)
New Revision: 29489

Modified:
   grass/trunk/display/d.save/main.c
   grass/trunk/lib/display/window.c
Log:
round, don't truncate frame coordinate. keep consistent data type.
clean comments


Modified: grass/trunk/display/d.save/main.c
===================================================================
--- grass/trunk/display/d.save/main.c	2007-12-21 00:57:40 UTC (rev 29488)
+++ grass/trunk/display/d.save/main.c	2007-12-21 01:22:17 UTC (rev 29489)
@@ -72,7 +72,7 @@
 	struct GModule *module;
 	char buff[1024];
 	char current_frame[64];
-	double Ftop, Fbot, Fleft, Fright;
+	float Ftop, Fbot, Fleft, Fright;
 
 
 	G_gisinit(argv[0]);

Modified: grass/trunk/lib/display/window.c
===================================================================
--- grass/trunk/lib/display/window.c	2007-12-21 00:57:40 UTC (rev 29488)
+++ grass/trunk/lib/display/window.c	2007-12-21 01:22:17 UTC (rev 29489)
@@ -103,11 +103,10 @@
 /*!
  * \brief create new graphics frame, with coordinates in percent
  *
- * Creates a new frame <b>name</b> with
- * coordinates <b>top, bottom, left</b>, and <b>right</b> as
- * percentages of the screen size. If <b>name</b>
- * is the empty string '''' (i.e., *<b>name</b> = = 0), the routine returns a
- * unique string in <b>name.</b>
+ * Creates a new frame <b>name</b> with coordinates <b>top, bottom,
+ * left</b>, and <b>right</b> as percentages of the screen size.
+ * If <b>name</b> is the empty string "" (i.e., *<b>name</b> == 0),
+ * the routine returns a unique string in <b>name.</b>
  *
  *  \param name
  *  \param bottom
@@ -124,10 +123,10 @@
 	int scr_l = R_screen_left();
 	int scr_r = R_screen_rite();
 
-	int win_t = scr_t + (scr_b - scr_t) * (100. - t) / 100.0;
-	int win_b = scr_t + (scr_b - scr_t) * (100. - b) / 100.0;
-	int win_l = scr_l + (scr_r - scr_l) * l / 100.0;
-	int win_r = scr_l + (scr_r - scr_l) * r / 100.0;
+	int win_t = 0.5 + scr_t + (scr_b - scr_t) * (100. - t) / 100.0;
+	int win_b = 0.5 + scr_t + (scr_b - scr_t) * (100. - b) / 100.0;
+	int win_l = 0.5 + scr_l + (scr_r - scr_l) * l / 100.0;
+	int win_r = 0.5 + scr_l + (scr_r - scr_l) * r / 100.0;
 
 	if (win_t < scr_t) win_t = scr_t;
 	if (win_b > scr_b) win_b = scr_b;



More information about the grass-commit mailing list