[GRASS-SVN] r33051 - in grass/trunk: display/d.barscale display/d.colortable display/d.geodesic display/d.graph display/d.his display/d.histogram display/d.info display/d.labels display/d.legend display/d.linegraph display/d.measure display/d.path display/d.rast display/d.rast.arrow display/d.rast.num display/d.rgb display/d.rhumbline display/d.text display/d.vect.chart display/d.what.rast imagery/i.vpoints include lib/display vector/v.digit

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 24 15:12:11 EDT 2008


Author: glynn
Date: 2008-08-24 15:12:11 -0400 (Sun, 24 Aug 2008)
New Revision: 33051

Modified:
   grass/trunk/display/d.barscale/draw_scale.c
   grass/trunk/display/d.barscale/main.c
   grass/trunk/display/d.colortable/main.c
   grass/trunk/display/d.geodesic/plot.c
   grass/trunk/display/d.graph/do_graph.c
   grass/trunk/display/d.graph/main.c
   grass/trunk/display/d.his/main.c
   grass/trunk/display/d.histogram/bar.c
   grass/trunk/display/d.histogram/draw_slice.c
   grass/trunk/display/d.histogram/main.c
   grass/trunk/display/d.histogram/pie.c
   grass/trunk/display/d.info/main.c
   grass/trunk/display/d.labels/main.c
   grass/trunk/display/d.legend/main.c
   grass/trunk/display/d.linegraph/main.c
   grass/trunk/display/d.measure/msurements.c
   grass/trunk/display/d.path/select.c
   grass/trunk/display/d.rast.arrow/main.c
   grass/trunk/display/d.rast.num/main.c
   grass/trunk/display/d.rast/display.c
   grass/trunk/display/d.rgb/main.c
   grass/trunk/display/d.rhumbline/plot.c
   grass/trunk/display/d.text/main.c
   grass/trunk/display/d.vect.chart/bar.c
   grass/trunk/display/d.vect.chart/pie.c
   grass/trunk/display/d.what.rast/main.c
   grass/trunk/imagery/i.vpoints/setup.c
   grass/trunk/include/display.h
   grass/trunk/lib/display/cnversions.c
   grass/trunk/lib/display/draw2.c
   grass/trunk/lib/display/icon.c
   grass/trunk/lib/display/raster.c
   grass/trunk/lib/display/setup.c
   grass/trunk/lib/display/window.c
   grass/trunk/vector/v.digit/driver.c
Log:
Display library changes: generalise conversion code


Modified: grass/trunk/display/d.barscale/draw_scale.c
===================================================================
--- grass/trunk/display/d.barscale/draw_scale.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.barscale/draw_scale.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -74,7 +74,7 @@
     const struct scale *scales = all_scales[use_feet];
 
     /* Establish text size */
-    D_get_screen_window(&t, &b, &l, &r);
+    D_get_dst(&t, &b, &l, &r);
     R_set_window(t, b, l, r);
     size = 14;
     R_text_size(size, size);

Modified: grass/trunk/display/d.barscale/main.c
===================================================================
--- grass/trunk/display/d.barscale/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.barscale/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -41,8 +41,6 @@
 
 int main(int argc, char **argv)
 {
-    struct Cell_head window;
-    double t, b, l, r;
     struct GModule *module;
     struct Option *opt1, *opt2, *opt3;
     struct Flag *feet, *top, *linescale, *northarrow, *scalebar;
@@ -131,6 +129,8 @@
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
+    D_setup(0);
+
     /* Parse and select background color */
     color1 = D_parse_color(opt1->answer, 1);
     if (color1 == 0)
@@ -139,21 +139,6 @@
     /* Parse and select foreground color */
     color2 = D_parse_color(opt2->answer, 0);
 
-
-    /* Read in the map window associated with window */
-    G_get_window(&window);
-
-    D_check_map_window(&window);
-
-    if (G_set_window(&window) == -1)
-	G_fatal_error(_("Current window not settable"));
-
-    /* Determine conversion factors */
-    D_get_screen_window(&t, &b, &l, &r);
-
-    if (D_do_conversions(&window, t, b, l, r))
-	G_fatal_error(_("Error in calculating conversions"));
-
     /* Draw the scale */
     draw_scale(top->answer);
 

Modified: grass/trunk/display/d.colortable/main.c
===================================================================
--- grass/trunk/display/d.colortable/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.colortable/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -147,7 +147,7 @@
 	G_fatal_error("No graphics device selected");
 
     /* Figure out where to put boxes */
-    D_get_screen_window(&t, &b, &l, &r);
+    R_get_window(&t, &b, &l, &r);
 
     G_get_fp_range_min_max(&fp_range, &dmin, &dmax);
     if (G_is_d_null_value(&dmin) || G_is_d_null_value(&dmax))

Modified: grass/trunk/display/d.geodesic/plot.c
===================================================================
--- grass/trunk/display/d.geodesic/plot.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.geodesic/plot.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -18,12 +18,16 @@
 int setup_plot(void)
 {
     double a, e2;
+    double t, b, l, r;
 
     /* establish the current graphics window */
     D_setup(0);
 
+    D_get_dst(&t, &b, &l, &r);
+    D_set_src(t, b, l, r);
+    D_update_conversions();
     /* set D clip window */
-    D_clip_to_display();
+    D_clip_to_map();
 
     /* setup the G plot to use the D routines */
     G_setup_plot(D_get_d_north(),
@@ -102,7 +106,7 @@
 
 static int move(int x, int y)
 {
-    D_move_abs_clip(x, y);
+    D_move_abs(x, y);
 
     return 0;
 }

Modified: grass/trunk/display/d.graph/do_graph.c
===================================================================
--- grass/trunk/display/d.graph/do_graph.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.graph/do_graph.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -63,7 +63,7 @@
 	   yper > D_get_u_north() )
 	   return(-1);
 	 */
-	R_cont_abs(D_u_to_d_col(xper), D_u_to_d_row(yper));
+	D_cont_abs(xper, yper);
     }
     else {
 	if (xper < 0. || yper < 0. || xper > 100. || yper > 100.)
@@ -84,7 +84,7 @@
     }
 
     if (mapunits)
-	R_move_abs(D_u_to_d_col(xper), D_u_to_d_row(yper));
+	D_move_abs(xper, yper);
     else {
 	if (xper < 0. || yper < 0. || xper > 100. || yper > 100.)
 	    return (-1);

Modified: grass/trunk/display/d.graph/main.c
===================================================================
--- grass/trunk/display/d.graph/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.graph/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -119,11 +119,8 @@
     else
 	mapunits = FALSE;
 
-    D_get_screen_window(&t, &b, &l, &r);
-
-    /* Finish graphics setup */
-    R_set_window(t, b, l, r);
     D_setup(0);
+    D_get_dst(&t, &b, &l, &r);
 
     /* Do the graphics */
     set_graph_stuff();

Modified: grass/trunk/display/d.his/main.c
===================================================================
--- grass/trunk/display/d.his/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.his/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -116,7 +116,8 @@
 	G_fatal_error(_("No graphics device selected"));
 
     /* Prepare the raster cell drawing functions */
-    D_get_screen_window(&t, &b, &l, &r);
+    D_setup(0);
+    D_get_dst(&t, &b, &l, &r);
     D_set_overlay_mode(nulldraw->answer ? 1 : 0);
     D_cell_draw_setup(t, b, l, r);
 

Modified: grass/trunk/display/d.histogram/bar.c
===================================================================
--- grass/trunk/display/d.histogram/bar.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.histogram/bar.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -65,11 +65,9 @@
     char ylabel[1024];
     char txt[1024];
     char tic_name[80];
-    extern int stash_away();
 
     /* get coordinates of current screen window, in pixels */
-    D_get_screen_window(&t, &b, &l, &r);
-    R_set_window(t, b, l, r);
+    D_get_dst(&t, &b, &l, &r);
 
     /* create axis lines, to be drawn later */
     height = b - t;

Modified: grass/trunk/display/d.histogram/draw_slice.c
===================================================================
--- grass/trunk/display/d.histogram/draw_slice.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.histogram/draw_slice.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -19,7 +19,7 @@
     double arc, arc_incr = 0.01;
     DCELL fill_color;
 
-    D_get_screen_window(&tt, &tb, &tl, &tr);
+    D_get_dst(&tt, &tb, &tl, &tr);
 
     height = tb - tt;
     width = tr - tl;

Modified: grass/trunk/display/d.histogram/main.c
===================================================================
--- grass/trunk/display/d.histogram/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.histogram/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -64,7 +64,6 @@
     struct Categories cats;
     struct Range range;
     struct Colors pcolors;
-    int bgcolor;
     char title[512];
     double tt, tb, tl, tr;
     double t, b, l, r;
@@ -145,7 +144,6 @@
     map_name = opt1->answer;
 
     color = D_parse_color(opt2->answer, FALSE);
-    bgcolor = D_parse_color(bg_opt->answer, TRUE);
 
     type = COUNT;
 #ifdef CAN_DO_AREAS
@@ -196,14 +194,11 @@
 	G_fatal_error(_("No graphics device selected"));
 
     D_setup(0);			/* 0 = don't clear frame */
-    D_get_screen_window(&t, &b, &l, &r);
+    D_get_dst(&t, &b, &l, &r);
 
     /* clear the frame, if requested to do so */
-    if (strcmp(bg_opt->answer, "none")) {
-	/*          D_clear_window(); *//* clears d.save history: but also any font setting! */
-	D_raster_use_color(bgcolor);
-	R_box_abs(l, t, r, b);
-    }
+    if (strcmp(bg_opt->answer, "none") != 0)
+	D_erase(bg_opt->answer);
 
     /* draw a title for */
     sprintf(title, "%s in mapset %s", map_name, mapset);

Modified: grass/trunk/display/d.histogram/pie.c
===================================================================
--- grass/trunk/display/d.histogram/pie.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.histogram/pie.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -71,8 +71,7 @@
     DCELL dmin, dmax, range_dmin, range_dmax, dval;
 
     /* get coordinates of current screen window, in pixels */
-    D_get_screen_window(&t, &b, &l, &r);
-    R_set_window(t, b, l, r);
+    D_get_dst(&t, &b, &l, &r);
 
     /* create legend box border, to be drawn later */
     height = b - t;

Modified: grass/trunk/display/d.info/main.c
===================================================================
--- grass/trunk/display/d.info/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.info/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -84,19 +84,13 @@
 	fprintf(stdout, "colors: %d\n", R_get_num_colors());
 
     if (fflag->answer) {
-	D_get_screen_window(&t, &b, &l, &r);
+	R_get_window(&t, &b, &l, &r);
 	fprintf(stdout, "frame: %f %f %f %f\n", l, r, t, b);
     }
 
     if (bflag->answer) {
-	/* Read in the map window associated with window */
-	G_get_window(&window);
+	D_setup(0);
 
-	D_check_map_window(&window);
-	D_get_screen_window(&t, &b, &l, &r);
-	if (D_do_conversions(&window, t, b, l, r))
-	    G_fatal_error(_("Error in calculating conversions"));
-
 	l = D_get_d_west();
 	r = D_get_d_east();
 	t = D_get_d_north();

Modified: grass/trunk/display/d.labels/main.c
===================================================================
--- grass/trunk/display/d.labels/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.labels/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -31,7 +31,6 @@
     char *mapset;
     double minreg, maxreg, reg, dx, dy;
     FILE *infile;
-    double t, b, l, r;
     struct Option *opt1;
     struct Option *maxreg_opt, *minreg_opt;
     struct Flag *horiz_flag;
@@ -85,9 +84,6 @@
     if (mapset == NULL)
 	G_fatal_error(_("Label file <%s> not found"), label_name);
 
-    if (R_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
     /* Read in the map window associated with window */
     G_get_window(&window);
 
@@ -117,20 +113,14 @@
     if (infile == NULL)
 	G_fatal_error(_("Unable to open label file <%s>"), label_name);
 
-    D_check_map_window(&window);
+    if (R_open_driver() != 0)
+	G_fatal_error(_("No graphics device selected"));
 
-    if (G_set_window(&window) == -1)
-	G_fatal_error(_("Current window not settable"));
+    D_setup(0);
 
-    /* Determine conversion factors */
-    D_get_screen_window(&t, &b, &l, &r);
-    if (D_do_conversions(&window, t, b, l, r))
-	G_fatal_error(_("Error in calculating conversions"));
-
     /* Go draw the raster map */
     do_labels(infile, !horiz_flag->answer);
 
-    R_text_rotation(0.0);	/* reset */
     R_close_driver();
 
     exit(0);

Modified: grass/trunk/display/d.legend/main.c
===================================================================
--- grass/trunk/display/d.legend/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.legend/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -271,8 +271,8 @@
     black = D_translate_color(DEFAULT_BG_COLOR);
 
     /* Figure out where to put text */
-    D_get_screen_window(&t, &b, &l, &r);
-    R_set_window(t, b, l, r);
+    D_setup(0);
+    D_get_dst(&t, &b, &l, &r);
 
     if (opt7->answer != NULL) {
 	sscanf(opt7->answers[0], "%lf", &Y1);

Modified: grass/trunk/display/d.linegraph/main.c
===================================================================
--- grass/trunk/display/d.linegraph/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.linegraph/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -249,8 +249,8 @@
     /* get coordinates of current screen window, in pixels */
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
-    D_get_screen_window(&t, &b, &l, &r);
-    R_set_window(t, b, l, r);
+    D_setup(0);
+    D_get_dst(&t, &b, &l, &r);
 
     /* create axis lines, to be drawn later */
     height = b - t;

Modified: grass/trunk/display/d.measure/msurements.c
===================================================================
--- grass/trunk/display/d.measure/msurements.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.measure/msurements.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -36,7 +36,7 @@
     G_begin_distance_calculations();
 
     G_get_window(&window);
-    D_get_screen_window(&t, &b, &l, &r);
+    D_get_dst(&t, &b, &l, &r);
     D_do_conversions(&window, t, b, l, r);
 
     for (;;) {

Modified: grass/trunk/display/d.path/select.c
===================================================================
--- grass/trunk/display/d.path/select.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.path/select.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -15,7 +15,7 @@
 int display(struct Map_info *Map, struct line_pnts *Points,
 	    const struct color_rgb *color, int first, int last, int be_bold)
 {
-    int i, from, to;
+    int from, to;
 
     R_RGB_color(color->r, color->g, color->b);
 
@@ -31,11 +31,7 @@
     if (be_bold)
 	D_line_width(2);
 
-    for (i = from; i < to - 1; i++)
-    {
-	D_move(Points->x[i], Points->y[i]);
-	D_cont(Points->x[i + 1], Points->y[i + 1]);
-    }
+    D_polyline(&Points->x[from], &Points->y[from], to - from);
 
     if (be_bold)
 	R_line_width(0);

Modified: grass/trunk/display/d.rast/display.c
===================================================================
--- grass/trunk/display/d.rast/display.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.rast/display.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -58,7 +58,7 @@
     nrows = G_window_rows();
 
     /* Set up the screen, conversions, and graphics */
-    D_get_screen_window(&t, &b, &l, &r);
+    D_get_dst(&t, &b, &l, &r);
     D_set_overlay_mode(overlay);
     if (D_cell_draw_setup(t, b, l, r))
 	G_fatal_error(_("Cannot use current window"));

Modified: grass/trunk/display/d.rast.arrow/main.c
===================================================================
--- grass/trunk/display/d.rast.arrow/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.rast.arrow/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -59,33 +59,20 @@
 static void draw_x(void);
 static void unknown_(void);
 
-int D_x, D_y;
-double D_ew, D_ns;
-char *mapset;
-char layer_name[128];
-int map_type, arrow_color, grid_color, x_color, unknown_color;
+static char *mapset;
+static char layer_name[128];
+static int map_type, arrow_color, grid_color, x_color, unknown_color;
+static int row, col;
 
-
 int main(int argc, char **argv)
 {
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
     struct Cell_head window;
-    double t, b, l, r;
     RASTER_MAP_TYPE raster_type, mag_raster_type = -1;
     int layer_fd;
     void *raster_row, *ptr;
-    int nrows, ncols, row, col;
+    int nrows, ncols;
     int aspect_c = -1;
     float aspect_f = -1.0;
-    double ew_res, ns_res;
-    double D_south, D_west;
-    double D_north, D_east;
-    double U_to_D_xconv, U_to_D_yconv;
-    double U_west, U_south;
-    double U_east, U_north;
-    double U_start;
-    double U_x, U_y;
 
     double scale;
     int skip, no_arrow;
@@ -234,60 +221,17 @@
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
+    D_setup(0);
+
     /* Read in the map window associated with window */
     G_get_window(&window);
 
-    D_check_map_window(&window);
-
-    if (G_set_window(&window) == -1)
-	G_fatal_error(_("Current window not settable"));
-
-    /* Determine conversion factors */
-    D_get_screen_window(&t, &b, &l, &r);
-    if (D_do_conversions(&window, t, b, l, r))
-	G_fatal_error(_("Error in calculating conversions"));
-
-    /* where are we, both geographically and on the screen? */
-    D_south = D_get_d_south();
-    D_north = D_get_d_north();
-    D_east = D_get_d_east();
-    D_west = D_get_d_west();
-
-    U_west = D_get_u_west();
-    U_east = D_get_u_east();
-    U_south = D_get_u_south();
-    U_north = D_get_u_north();
-
-    U_to_D_xconv = D_get_u_to_d_xconv();
-    U_to_D_yconv = D_get_u_to_d_yconv();
-
-    /* number of rows and cols in window */
     nrows = window.rows;
     ncols = window.cols;
 
-    /*
-       if ((nrows > 75) || (ncols > 75)){ 
-       fprintf (stdout,"\n"); 
-       fprintf (stdout,"Current window size:\n"); 
-       fprintf (stdout,"rows:    %d\n", nrows);
-       fprintf (stdout,"columns: %d\n", ncols);
-       fprintf (stdout,"\n"); 
-       fprintf (stdout,"Your current window setting may be too large.\n"); 
-       fprintf (stdout,"Cells displayed on your graphics window may be too\n"); 
-       fprintf (stdout,"small for arrows to be visible.\n\n"); 
-       if (!G_yes("Do you wish to continue", 0))
-       exit(0);
-       }
-     */
+    D_set_src(0, nrows, 0, ncols);
+    D_update_conversions();
 
-    /* resolutions */
-    ew_res = window.ew_res;
-    ns_res = window.ns_res;
-
-    /* how many screen units of distance for each cell */
-    D_ew = (D_east - D_west) / ncols;
-    D_ns = (D_south - D_north) / nrows;
-
     /* figure out arrow scaling if using a magnitude map */
     if (opt7->answer) {
 	G_init_fp_range(&range);	/* really needed? */
@@ -295,51 +239,24 @@
 	    G_fatal_error(_("Problem reading range file"));
 	G_get_fp_range_min_max(&range, &mag_min, &mag_max);
 
-	scale *= 1.5 * ((D_ew < D_ns) ? D_ew : D_ns) / fabs(mag_max);
-	G_debug(3, "scaling=%.2f  rast_max=%.2f  D_ew=%.2f", scale, mag_max,
-		D_ew);
+	scale *= 1.5 / fabs(mag_max);
+	G_debug(3, "scaling=%.2f  rast_max=%.2f", scale, mag_max);
     }
 
-/*------------------------------------------
-    fprintf (stdout,"ew_res:  %.2f\n", window.ew_res);
-    fprintf (stdout,"ns_res:  %.2f\n", window.ns_res);
-    fprintf (stdout,"D_ew:  %f D_ns:  %f \n", D_ew, D_ns); 
-    fprintf (stdout,"nrows:    %d\n", nrows);
-    fprintf (stdout,"ncols:    %d\n", ncols);
-    fprintf (stdout,"t:  %d\n", t);
-    fprintf (stdout,"b:  %d\n", b);
-    fprintf (stdout,"l:  %d\n", l);
-    fprintf (stdout,"r:  %d\n", r);
-    fprintf (stdout,"U_west:	%f\n", U_west);
-    fprintf (stdout,"U_east:	%f\n", U_east);
-    fprintf (stdout,"U_south:	%f\n", U_south);
-    fprintf (stdout,"U_north:	%f\n", U_north);
-    fprintf (stdout,"D_west:	%f\n", D_west);
-    fprintf (stdout,"D_east:	%f\n", D_east);
-    fprintf (stdout,"D_south:	%f\n", D_south);
-    fprintf (stdout,"D_north:	%f\n", D_north);
-    fprintf (stdout,"U_to_D_xconv:	%f\n", U_to_D_xconv);
-    fprintf (stdout,"U_to_D_yconv:	%f\n", U_to_D_yconv);
---------------------------------------------------------*/
-
     if (grid_color > 0) {	/* ie not "none" */
 	/* Set color */
 	R_standard_color(grid_color);
 
 	/* Draw vertical grids */
-	U_start = U_east;
-	for (U_x = U_start; U_x >= U_west; U_x -= ew_res) {
-	    D_x = (int)((U_x - U_west) * U_to_D_xconv + D_west);
-	    R_move_abs(D_x, (int)D_south);
-	    R_cont_abs(D_x, (int)D_north);
+	for (col = 0; col < ncols; col++) {
+	    D_move_abs(col, 0);
+	    D_cont_abs(col, nrows);
 	}
 
 	/* Draw horizontal grids */
-	U_start = U_north;
-	for (U_y = U_start; U_y >= U_south; U_y -= ns_res) {
-	    D_y = (int)((U_south - U_y) * U_to_D_yconv + D_south);
-	    R_move_abs((int)D_west, D_y);
-	    R_cont_abs((int)D_east, D_y);
+	for (row = 0; row < nrows; row++) {
+	    D_move_abs(0,     row);
+	    D_cont_abs(ncols, row);
 	}
     }
 
@@ -379,9 +296,6 @@
 	    mag_ptr = mag_raster_row;
 	}
 
-	/* determine screen y coordinate of top of current cell */
-	D_y = (int)(row * D_ns + D_north);
-
 	for (col = 0; col < ncols; col++) {
 
 	    if (row % skip != 0)
@@ -392,9 +306,6 @@
 	    if (col % skip != 0)
 		no_arrow = TRUE;
 
-	    /* determine screen x coordinate of west side of current cell */
-	    D_x = (int)(col * D_ew + D_west);
-
 	    /* find aspect direction based on cell value */
 	    if (raster_type == CELL_TYPE)
 		aspect_f = *((CELL *) ptr);
@@ -577,242 +488,199 @@
 
 static void arrow_mag(double theta, double length)
 {				/* angle is measured in degrees counter-clockwise from east */
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
-    int x, y, dx, dy, mid_x, mid_y;
+    double x, y, dx, dy, mid_x, mid_y;
     double theta_offset;
 
     theta *= -1;		/* display coords use inverse y */
 
     /* find the display coordinates of the middle of the cell */
-    mid_x = D_x + (int)(D_ew * .5);
-    mid_y = D_y + (int)(D_ns * .5);
+    mid_x = col + (.5);
+    mid_y = row + (.5);
 
     /* tail */
-    R_move_abs(mid_x, mid_y);
+    D_move_abs(mid_x, mid_y);
 
     /* head */
-    x = mid_x + (int)(length * cos(D2R(theta)));
-    y = mid_y + (int)(length * sin(D2R(theta)));
-    R_cont_abs(x, y);
+    x = mid_x + (length * cos(D2R(theta)));
+    y = mid_y + (length * sin(D2R(theta)));
+    D_cont_abs(x, y);
 
     /* fin 1 */
     theta_offset = theta + 20;
-    dx = mid_x + (int)(0.6 * length * cos(D2R(theta_offset)));
-    dy = mid_y + (int)(0.6 * length * sin(D2R(theta_offset)));
-    R_cont_abs(dx, dy);
+    dx = mid_x + (0.6 * length * cos(D2R(theta_offset)));
+    dy = mid_y + (0.6 * length * sin(D2R(theta_offset)));
+    D_cont_abs(dx, dy);
 
     /* fin 2 */
-    R_move_abs(x, y);
+    D_move_abs(x, y);
     theta_offset = theta - 20;
-    dx = mid_x + (int)(0.6 * length * cos(D2R(theta_offset)));
-    dy = mid_y + (int)(0.6 * length * sin(D2R(theta_offset)));
-    R_cont_abs(dx, dy);
+    dx = mid_x + (0.6 * length * cos(D2R(theta_offset)));
+    dy = mid_y + (0.6 * length * sin(D2R(theta_offset)));
+    D_cont_abs(dx, dy);
 }
 
 
 static void arrow_360(double theta)
 {				/* angle is measured in degrees counter-clockwise from east */
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
-    int x, y, dx, dy, mid_x, mid_y;
+    double x, y, dx, dy, mid_x, mid_y;
     double max_radius, theta_offset;
 
     theta *= -1;		/* display coords use inverse y */
-    max_radius = ((D_ew < D_ns) ? D_ew : D_ns) * 0.8 / 2;
+    max_radius = 0.8 / 2;
 
     /* find the display coordinates of the middle of the cell */
-    mid_x = D_x + (int)(D_ew * 0.5);
-    mid_y = D_y + (int)(D_ns * 0.5);
+    mid_x = col + (0.5);
+    mid_y = row + (0.5);
 
     /* head */
-    x = mid_x + (int)(max_radius * cos(D2R(theta)));
-    y = mid_y + (int)(max_radius * sin(D2R(theta)));
-    R_move_abs(x, y);
+    x = mid_x + (max_radius * cos(D2R(theta)));
+    y = mid_y + (max_radius * sin(D2R(theta)));
+    D_move_abs(x, y);
 
     /* tail */
-    dx = -2 * (int)(max_radius * cos(D2R(theta)));
-    dy = -2 * (int)(max_radius * sin(D2R(theta)));
-    R_cont_rel(dx, dy);
+    dx = -2 * (max_radius * cos(D2R(theta)));
+    dy = -2 * (max_radius * sin(D2R(theta)));
+    D_cont_rel(dx, dy);
 
     /* fin 1 */
-    R_move_abs(x, y);
+    D_move_abs(x, y);
     theta_offset = theta + 90;
-    dx = mid_x + (int)(0.5 * max_radius * cos(D2R(theta_offset)));
-    dy = mid_y + (int)(0.5 * max_radius * sin(D2R(theta_offset)));
-    R_cont_abs(dx, dy);
+    dx = mid_x + (0.5 * max_radius * cos(D2R(theta_offset)));
+    dy = mid_y + (0.5 * max_radius * sin(D2R(theta_offset)));
+    D_cont_abs(dx, dy);
 
     /* fin 2 */
-    R_move_abs(x, y);
+    D_move_abs(x, y);
     theta_offset = theta - 90;
-    dx = mid_x + (int)(0.5 * max_radius * cos(D2R(theta_offset)));
-    dy = mid_y + (int)(0.5 * max_radius * sin(D2R(theta_offset)));
-    R_cont_abs(dx, dy);
+    dx = mid_x + (0.5 * max_radius * cos(D2R(theta_offset)));
+    dy = mid_y + (0.5 * max_radius * sin(D2R(theta_offset)));
+    D_cont_abs(dx, dy);
 
 }
 
 static void arrow_se(void)
 {
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
-    int x, y;
+    double x = col + (.8);
+    double y = row + (.8);
+    D_move_abs(x, y);
+    D_cont_rel(((-.6)), (((-.6))));
+    D_move_abs(x, y);
+    D_cont_rel(0, ((-.4)));
+    D_move_abs(x, y);
+    D_cont_rel(((-.4)), 0);
 
-    x = D_x + (int)(D_ew * .8);
-    y = D_y + (int)(D_ns * .8);
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (-.6)), ((int)(D_ns * (-.6))));
-    R_move_abs(x, y);
-    R_cont_rel(0, (int)(D_ns * (-.4)));
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (-.4)), 0);
-
 }
 
 static void arrow_ne(void)
 {
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
-    int x, y;
+    double x = col + (.8);
+    double y = row + (.2);
+    D_move_abs(x, y);
+    D_cont_rel(((-.6)), (((.6))));
+    D_move_abs(x, y);
+    D_cont_rel(0, ((.4)));
+    D_move_abs(x, y);
+    D_cont_rel(((-.4)), 0);
 
-    x = D_x + (int)(D_ew * .8);
-    y = D_y + (int)(D_ns * .2);
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (-.6)), ((int)(D_ns * (.6))));
-    R_move_abs(x, y);
-    R_cont_rel(0, (int)(D_ns * (.4)));
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (-.4)), 0);
-
 }
 
 static void arrow_nw(void)
 {
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
-    int x, y;
+    double x = col + (.2);
+    double y = row + (.2);
+    D_move_abs(x, y);
+    D_cont_rel(((.6)), (((.6))));
+    D_move_abs(x, y);
+    D_cont_rel(0, ((.4)));
+    D_move_abs(x, y);
+    D_cont_rel(((.4)), 0);
 
-    x = D_x + (int)(D_ew * .2);
-    y = D_y + (int)(D_ns * .2);
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (.6)), ((int)(D_ns * (.6))));
-    R_move_abs(x, y);
-    R_cont_rel(0, (int)(D_ns * (.4)));
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (.4)), 0);
-
 }
 
 static void arrow_sw(void)
 {
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
-    int x, y;
+    double x = col + (.2);
+    double y = row + (.8);
+    D_move_abs(x, y);
+    D_cont_rel(((.6)), (((-.6))));
+    D_move_abs(x, y);
+    D_cont_rel(0, ((-.4)));
+    D_move_abs(x, y);
+    D_cont_rel(((.4)), 0);
 
-    x = D_x + (int)(D_ew * .2);
-    y = D_y + (int)(D_ns * .8);
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (.6)), ((int)(D_ns * (-.6))));
-    R_move_abs(x, y);
-    R_cont_rel(0, (int)(D_ns * (-.4)));
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (.4)), 0);
-
 }
 static void arrow_e(void)
 {
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
-    int x, y;
+    double x = col + (.9);
+    double y = row + (.5);
+    D_move_abs(x, y);
+    D_cont_rel(((-.8)), 0);
+    D_move_abs(x, y);
+    D_cont_rel(((-.3)), ((-.3)));
+    D_move_abs(x, y);
+    D_cont_rel(((-.3)), ((.3)));
 
-    x = D_x + (int)(D_ew * .9);
-    y = D_y + (int)(D_ns * .5);
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (-.8)), 0);
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (-.3)), (int)(D_ns * (-.3)));
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (-.3)), (int)(D_ns * (.3)));
-
 }
 static void arrow_w(void)
 {
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
-    int x, y;
+    double x = col + (.1);
+    double y = row + (.5);
+    D_move_abs(x, y);
+    D_cont_rel(((.8)), 0);
+    D_move_abs(x, y);
+    D_cont_rel(((.3)), ((-.3)));
+    D_move_abs(x, y);
+    D_cont_rel(((.3)), ((.3)));
 
-    x = D_x + (int)(D_ew * .1);
-    y = D_y + (int)(D_ns * .5);
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (.8)), 0);
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (.3)), (int)(D_ns * (-.3)));
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (.3)), (int)(D_ns * (.3)));
-
 }
 static void arrow_s(void)
 {
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
-    int x, y;
+    double x = col + (.5);
+    double y = row + (.9);
+    D_move_abs(x, y);
+    D_cont_rel(0, ((-.8)));
+    D_move_abs(x, y);
+    D_cont_rel(((.3)), ((-.3)));
+    D_move_abs(x, y);
+    D_cont_rel(((-.3)), ((-.3)));
 
-    x = D_x + (int)(D_ew * .5);
-    y = D_y + (int)(D_ns * .9);
-    R_move_abs(x, y);
-    R_cont_rel(0, (int)(D_ns * (-.8)));
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (.3)), (int)(D_ns * (-.3)));
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (-.3)), (int)(D_ns * (-.3)));
-
 }
 static void arrow_n(void)
 {
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
-    int x, y;
+    double x = col + (.5);
+    double y = row + (.1);
+    D_move_abs(x, y);
+    D_cont_rel(0, ((.8)));
+    D_move_abs(x, y);
+    D_cont_rel(((.3)), ((.3)));
+    D_move_abs(x, y);
+    D_cont_rel(((-.3)), ((.3)));
 
-    x = D_x + (int)(D_ew * .5);
-    y = D_y + (int)(D_ns * .1);
-    R_move_abs(x, y);
-    R_cont_rel(0, (int)(D_ns * (.8)));
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (.3)), (int)(D_ns * (.3)));
-    R_move_abs(x, y);
-    R_cont_rel((int)(D_ew * (-.3)), (int)(D_ns * (.3)));
-
 }
 static void draw_x(void)
 {
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
-    int x, y;
-
-    x = D_x;
-    y = D_y;
-    R_move_abs(x, y);
-    R_cont_rel((int)D_ew, (int)D_ns);
-    y = D_y + (int)D_ns;
-    R_move_abs(x, y);
-    R_cont_rel((int)D_ew, (int)(D_ns * -1));
+    double x = col;
+    double y = row;
+    D_move_abs(x, y);
+    D_cont_rel(1, 1);
+    y = row + 1;
+    D_move_abs(x, y);
+    D_cont_rel(1, (-1));
 }
 static void unknown_(void)
 {
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
-    int x, y;
+    double x = col + (.3);
+    double y = row + (.4);
 
-    x = D_x + (int)(D_ew * .3);
-    y = D_y + (int)(D_ns * .4);
-    R_move_abs(x, y);
-    R_cont_rel(0, (int)(D_ns * (-.15)));
-    R_cont_rel((int)(D_ew * (.1)), (int)(D_ns * (-.1)));
-    R_cont_rel((int)(D_ew * (.2)), 0);
-    R_cont_rel((int)(D_ew * (.1)), (int)(D_ns * (.1)));
-    R_cont_rel(0, (int)(D_ns * (.2)));
-    R_cont_rel((int)(D_ew * (-.1)), (int)(D_ns * (.1)));
-    R_cont_rel((int)(D_ew * (-.1)), 0);
-    R_cont_rel(0, (int)(D_ns * (.25)));
-    R_move_rel(0, (int)(D_ns * (.1)));
-    R_cont_rel(0, (int)(D_ns * (.1)));
+    D_move_abs(x, y);
+    D_cont_rel(0, ((-.15)));
+    D_cont_rel(((.1)), ((-.1)));
+    D_cont_rel(((.2)), 0);
+    D_cont_rel(((.1)), ((.1)));
+    D_cont_rel(0, ((.2)));
+    D_cont_rel(((-.1)), ((.1)));
+    D_cont_rel(((-.1)), 0);
+    D_cont_rel(0, ((.25)));
+    D_move_rel(0, ((.1)));
+    D_cont_rel(0, ((.1)));
 }

Modified: grass/trunk/display/d.rast.num/main.c
===================================================================
--- grass/trunk/display/d.rast.num/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.rast.num/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -36,37 +36,27 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <math.h>
 #include <grass/gis.h>
 #include <grass/raster.h>
 #include <grass/display.h>
 #include <grass/colors.h>
 #include <grass/glocale.h>
 
-int draw_number(double, int, RASTER_MAP_TYPE);
+int draw_number(int, int, double, int, RASTER_MAP_TYPE);
 
-int D_x, D_y;
-double D_ew, D_ns;
+static double D_ew, D_ns;
 
 int main(int argc, char **argv)
 {
     DCELL *cell;
     char *mapset;
     char full_name[128];
-    double D_north, D_east;
-    double D_south, D_west;
-    double U_east, U_north;
-    double U_start;
-    double U_to_D_xconv, U_to_D_yconv;
-    double U_west, U_south;
-    double U_x, U_y;
     double ew_res, ns_res;
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
     int fixed_color, grid_color;
     int R, G, B;
     int layer_fd;
     int nrows, ncols, row, col;
-    double t, b, l, r;
     int digits;
     struct Cell_head window;
     struct Colors colors;
@@ -121,9 +111,6 @@
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-    if (R_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
     strcpy(full_name, opt1->answer);
 
     if (strcmp("none", opt2->answer) == 0)
@@ -150,41 +137,23 @@
 
     /* Setup driver and check important information */
 
-    /* Read in the map window associated with window */
+    if (R_open_driver() != 0)
+	G_fatal_error(_("No graphics device selected"));
 
-    G_get_window(&window);
+    D_setup(0);
 
-    D_check_map_window(&window);
+    D_ns = fabs(D_get_a_to_d_yconv());
+    D_ew = fabs(D_get_a_to_d_xconv());
 
-    if (G_set_window(&window) == -1)
-	G_fatal_error(_("Current window not settable"));
+    /* Read in the map window associated with window */
 
-    /* Determine conversion factors */
+    G_get_window(&window);
 
-    D_get_screen_window(&t, &b, &l, &r);
-    if (D_do_conversions(&window, t, b, l, r))
-	G_fatal_error(_("Error in calculating conversions"));
-
-    /* where are we, both geographically and on the screen? */
-
-    D_south = D_get_d_south();
-    D_north = D_get_d_north();
-    D_east = D_get_d_east();
-    D_west = D_get_d_west();
-
-    U_west = D_get_u_west();
-    U_east = D_get_u_east();
-    U_south = D_get_u_south();
-    U_north = D_get_u_north();
-
-    U_to_D_xconv = D_get_u_to_d_xconv();
-    U_to_D_yconv = D_get_u_to_d_yconv();
-
-    /* number of rows and cols in window */
-
     nrows = window.rows;
     ncols = window.cols;
 
+    /* number of rows and cols in window */
+
     if ((nrows > 75) || (ncols > 75)) {
 	G_warning("!!!");
 	G_message(_("Current window size:"));
@@ -204,53 +173,23 @@
     ew_res = window.ew_res;
     ns_res = window.ns_res;
 
-    /* how many screen units of distance for each cell */
-    D_ew = (D_east - D_west) / ncols;
-    D_ns = (D_south - D_north) / nrows;
-
     /*set the number of significant digits */
     sscanf(prec->answer, "%i", &digits);
 
-	/*-- DEBUG ----------------------------------------
-	fprintf (stdout,"ew_res:  %.2f\n", window.ew_res);
-	fprintf (stdout,"ns_res:  %.2f\n", window.ns_res);
-	fprintf (stdout,"D_ew:  %f D_ns:  %f \n", D_ew, D_ns); 
-	fprintf (stdout,"nrows:    %d\n", nrows);
-	fprintf (stdout,"ncols:    %d\n", ncols);
-	fprintf (stdout,"t:  %d\n", t);
-	fprintf (stdout,"b:  %d\n", b);
-	fprintf (stdout,"l:  %d\n", l);
-	fprintf (stdout,"r:  %d\n", r);
-	fprintf (stdout,"U_west:    %f\n", U_west);
-	fprintf (stdout,"U_east:    %f\n", U_east);
-	fprintf (stdout,"U_south:   %f\n", U_south);
-	fprintf (stdout,"U_north:   %f\n", U_north);
-	fprintf (stdout,"D_west:    %f\n", D_west);
-	fprintf (stdout,"D_east:    %f\n", D_east);
-	fprintf (stdout,"D_south:   %f\n", D_south);
-	fprintf (stdout,"D_north:   %f\n", D_north);
-	fprintf (stdout,"U_to_D_xconv:      %f\n", U_to_D_xconv);
-	fprintf (stdout,"U_to_D_yconv:      %f\n", U_to_D_yconv);
-	--------------------------------------------------------*/
-
     if (grid_color > 0) {	/* ie not "none" */
 	/* Set grid color */
 	R_standard_color(grid_color);
 
 	/* Draw vertical grids */
-	U_start = U_east;
-	for (U_x = U_start; U_x >= U_west; U_x -= ew_res) {
-	    D_x = (U_x - U_west) * U_to_D_xconv + D_west;
-	    R_move_abs(D_x, D_south);
-	    R_cont_abs(D_x, D_north);
+	for (col = 0; col < ncols; col++) {
+	    D_move_abs(col, 0);
+	    D_cont_abs(col, nrows);
 	}
 
 	/* Draw horizontal grids */
-	U_start = U_north;
-	for (U_y = U_start; U_y >= U_south; U_y -= ns_res) {
-	    D_y = (U_south - U_y) * U_to_D_yconv + D_south;
-	    R_move_abs(D_west, D_y);
-	    R_cont_abs(D_east, D_y);
+	for (row = 0; row < nrows; row++) {
+	    D_move_abs(0,     row);
+	    D_cont_abs(ncols, row);
 	}
     }
 
@@ -269,20 +208,14 @@
     for (row = 0; row < nrows; row++) {
 	G_get_raster_row(layer_fd, cell, row, map_type);
 
-	/* determine screen y coordinate of top of current cell */
-
-	D_y = (int)(row * D_ns + D_north);
-
 	for (col = 0; col < ncols; col++) {
-	    /* determine screen x coordinate of west side of current cell */
-	    D_x = (int)(col * D_ew + D_west);
 
 	    if (fixed_color == 0) {
 		G_get_raster_color(&cell[col], &R, &G, &B, &colors, map_type);
 		R_RGB_color(R, G, B);
 	    }
 
-	    draw_number(cell[col], digits, inmap_type);
+	    draw_number(row, col, cell[col], digits, inmap_type);
 	}
     }
 
@@ -296,19 +229,16 @@
 /* --- end of main --- */
 
 
-int draw_number(double number, int prec, RASTER_MAP_TYPE map_type)
+int draw_number(int row, int col, double number, int prec, RASTER_MAP_TYPE map_type)
 {
-    extern double D_ew, D_ns;
-    extern int D_x, D_y;
     int len, text_size, rite;
     double tt, tb, tl, tr;
     char no[32];
     double dots_per_line, factor = 0.8;
     DCELL dcell = number;
     CELL cell = (int)number;
+    double x, y;
 
-    R_set_window(D_y, D_y + D_ns * 0.9, D_x, D_x + D_ew * 0.9);
-
     /* maybe ugly, but works */
     if (map_type == CELL_TYPE) {
 	if (!G_is_c_null_value(&cell))
@@ -341,7 +271,9 @@
        R_move_abs(D_x+(int)(D_ew*0.1),D_y+(int)(D_ns*0.5)) ;
        R_move_abs(D_x,D_y+(int)(dots_per_line - 1)) ;
      */
-    R_move_abs(D_x + D_ew / 2 - (tr - tl) / 2, D_y + D_ns * 0.7);
+    x = D_a_to_d_col(col + 0.5);
+    y = D_a_to_d_row(row + 0.7);
+    R_move_abs(x - (tr - tl) / 2, y);
     R_text(no);
 
     return 0;

Modified: grass/trunk/display/d.rgb/main.c
===================================================================
--- grass/trunk/display/d.rgb/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.rgb/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -83,7 +83,8 @@
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
-    D_get_screen_window(&t, &b, &l, &r);
+    D_setup(0);
+    D_get_dst(&t, &b, &l, &r);
     D_set_overlay_mode(flag_o->answer);
     D_cell_draw_setup(t, b, l, r);
 

Modified: grass/trunk/display/d.rhumbline/plot.c
===================================================================
--- grass/trunk/display/d.rhumbline/plot.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.rhumbline/plot.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -9,19 +9,11 @@
 
 #define METERS_TO_MILES(x) ((x) * 6.213712e-04)
 
-static int min_range[5], max_range[5];
-static int which_range;
-static int change_range;
-
 int setup_plot(void)
 {
-
     /* establish the current graphics window */
     D_setup(0);
 
-    /* set D clip window */
-    D_clip_to_display();
-
     /* setup the G plot to use the D routines */
     G_setup_plot(D_get_d_north(),
 		 D_get_d_south(), D_get_d_west(), D_get_d_east(), move, cont);
@@ -37,8 +29,6 @@
 {
     int text_x, text_y;
 
-    which_range = -1;
-    change_range = 1;
     R_standard_color(line_color);
     if (lon1 != lon2) {
 	G_shortest_way(&lon1, &lon2);
@@ -56,30 +46,14 @@
 
 static int cont(int x, int y)
 {
-    if (D_cont_abs_clip(x, y)) {	/* clipped */
-	change_range = 1;
-    }
-    else {			/* keep track of left,right x for lines drawn in window */
+    R_cont_abs(x, y);
 
-	if (change_range) {
-	    which_range++;
-	    min_range[which_range] = max_range[which_range] = x;
-	    change_range = 0;
-	}
-	else {
-	    if (x < min_range[which_range])
-		min_range[which_range] = x;
-	    else if (x > max_range[which_range])
-		max_range[which_range] = x;
-	}
-    }
-
     return 0;
 }
 
 static int move(int x, int y)
 {
-    D_move_abs_clip(x, y);
+    R_move_abs(x, y);
 
     return 0;
 }

Modified: grass/trunk/display/d.text/main.c
===================================================================
--- grass/trunk/display/d.text/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.text/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -291,8 +291,7 @@
     D_setup(0);
 
     /* figure out where to put text */
-    D_get_screen_window(&win.t, &win.b, &win.l, &win.r);
-    R_set_window(win.t, win.b, win.l, win.r);
+    D_get_dst(&win.t, &win.b, &win.l, &win.r);
 
     if (flag.s->answer)
 	size = atof(opt.size->answer);

Modified: grass/trunk/display/d.vect.chart/bar.c
===================================================================
--- grass/trunk/display/d.vect.chart/bar.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.vect.chart/bar.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -10,7 +10,7 @@
 bar(double cx, double cy, int size, double scale, double *val, int ncols,
     COLOR * ocolor, COLOR * colors, int y_center, double *max_reference)
 {
-    int i, j;
+    int i;
     double max;
     double x0, y0;
     double bw;			/* bar width */
@@ -60,9 +60,7 @@
 
 	    /* the outline color : default is black */
 	    R_RGB_color(ocolor->r, ocolor->g, ocolor->b);
-	    D_move(max_Points->x[j], max_Points->y[j]);
-	    for (j = 1; j < max_Points->n_points; j++)
-		D_cont(max_Points->x[j], max_Points->y[j]);
+	    D_polyline(max_Points->x, max_Points->y, max_Points->n_points);
 	}
     }
 
@@ -83,9 +81,7 @@
 	}
 
 	R_RGB_color(ocolor->r, ocolor->g, ocolor->b);
-	D_move(Points->x[0], Points->y[0]);
-	for (j = 1; j < Points->n_points; j++)
-	    D_cont(Points->x[j], Points->y[j]);
+	D_polyline(Points->x, Points->y, Points->n_points);
     }
 
     /* tidy up */

Modified: grass/trunk/display/d.vect.chart/pie.c
===================================================================
--- grass/trunk/display/d.vect.chart/pie.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.vect.chart/pie.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -58,9 +58,7 @@
 	}
 
 	R_RGB_color(ocolor->r, ocolor->g, ocolor->b);
-	D_move(Points->x[0], Points->y[0]);
-	for (j = 1; j < Points->n_points; j++)
-	    D_cont(Points->x[j], Points->y[j]);
+	D_polyline(Points->x, Points->y, Points->n_points);
     }
 
     Vect_destroy_line_struct(Points);

Modified: grass/trunk/display/d.what.rast/main.c
===================================================================
--- grass/trunk/display/d.what.rast/main.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/display/d.what.rast/main.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -29,8 +29,6 @@
 
 int main(int argc, char **argv)
 {
-    struct Cell_head window;
-    double t, b, l, r;
     int i, j;
     int width, mwidth;
     struct Flag *once, *terse, *colrow;
@@ -90,19 +88,8 @@
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
-    /* Read in the map window associated with window */
-    G_get_window(&window);
+    D_setup(0);
 
-    D_check_map_window(&window);
-
-    if (G_set_window(&window) == -1)
-	G_fatal_error(_("Can't set current graphics window"));
-
-    /* Determine conversion factors */
-    D_get_screen_window(&t, &b, &l, &r);
-    if (D_do_conversions(&window, t, b, l, r))
-	G_fatal_error(_("Error in calculating conversions"));
-
     if (rast) {
 	for (i = 0; rast[i]; i++) ;
 	nrasts = i;

Modified: grass/trunk/imagery/i.vpoints/setup.c
===================================================================
--- grass/trunk/imagery/i.vpoints/setup.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/imagery/i.vpoints/setup.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -59,8 +59,7 @@
 	G_fatal_error("Invalid graphics window coordinates");
 
     /* Determine conversion factors */
-    if (D_do_conversions(cellhead, t, b, l, r))
-	G_fatal_error("Error calculating graphics window conversions");
+    D_do_conversions(cellhead, t, b, l, r);
 
     D_set_clip(t, b, l, r);
 

Modified: grass/trunk/include/display.h
===================================================================
--- grass/trunk/include/display.h	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/include/display.h	2008-08-24 19:12:11 UTC (rev 33051)
@@ -5,10 +5,30 @@
 #include <grass/symbol.h>
 
 /* cnversions.c */
-int D_do_conversions(const struct Cell_head *, double, double, double, double);
+void D_update_conversions(void);
+void D_fit_d_to_u(void);
+void D_show_conversions(void);
+
+void D_do_conversions(const struct Cell_head *, double, double, double, double);
+
 int D_is_lat_lon(void);
+
+double D_get_d_to_a_xconv(void);
+double D_get_d_to_a_yconv(void);
+double D_get_d_to_u_xconv(void);
+double D_get_d_to_u_yconv(void);
+double D_get_a_to_u_xconv(void);
+double D_get_a_to_u_yconv(void);
+double D_get_a_to_d_xconv(void);
+double D_get_a_to_d_yconv(void);
 double D_get_u_to_d_xconv(void);
 double D_get_u_to_d_yconv(void);
+double D_get_u_to_a_xconv(void);
+double D_get_u_to_a_yconv(void);
+
+double D_get_ns_resolution(void);
+double D_get_ew_resolution(void);
+
 double D_get_u_west(void);
 double D_get_u_east(void);
 double D_get_u_north(void);
@@ -21,21 +41,31 @@
 double D_get_d_east(void);
 double D_get_d_north(void);
 double D_get_d_south(void);
-double D_u_to_a_row(double);
-double D_u_to_a_col(double);
+
+void D_set_region(const struct Cell_head *);
+void D_set_src(double, double, double, double);
+void D_get_src(double *, double *, double *, double *);
+void D_set_grid(int, int, int, int);
+void D_get_grid(int *, int *, int *, int *);
+void D_set_dst(double, double, double, double);
+void D_get_dst(double *, double *, double *, double *);
+
+void D_get_u(double [2][2]);
+void D_get_a(int [2][2]);
+void D_get_d(double [2][2]);
+
+double D_d_to_a_row(double);
+double D_d_to_a_col(double);
+double D_d_to_u_row(double);
+double D_d_to_u_col(double);
+double D_a_to_u_row(double);
+double D_a_to_u_col(double);
 double D_a_to_d_row(double);
 double D_a_to_d_col(double);
 double D_u_to_d_row(double);
 double D_u_to_d_col(double);
-double D_d_to_u_row(double);
-double D_d_to_u_col(double);
-double D_d_to_a_row(double);
-double D_d_to_a_col(double);
-double D_get_ns_resolution(void);
-double D_get_ew_resolution(void);
-void D_get_u(double[2][2]);
-void D_get_a(int[2][2]);
-void D_get_d(double[2][2]);
+double D_u_to_a_row(double);
+double D_u_to_a_col(double);
 
 /* color_list.c */
 char *D_color_list(void);
@@ -43,31 +73,34 @@
 /* draw2.c */
 void D_set_clip(double, double, double, double);
 void D_clip_to_map(void);
-void D_clip_to_display(void);
-void D_clip_to_screen(void);
-void D_move_clip(double, double);
-int D_cont_clip(double, double);
+
+void D_line_width(double);
+
+int D_cont_abs_cull(double, double);
+int D_cont_rel_cull(double, double);
+int D_line_cull(double, double, double, double);
+void D_polydots_cull(const double *, const double *, int);
+void D_polyline_cull(const double *, const double *, int);
+void D_polygon_cull(const double *, const double *, int);
+void D_box_cull(double, double, double, double);
+
+int D_cont_abs_clip(double, double);
+int D_cont_rel_clip(double, double);
 int D_line_clip(double, double, double, double);
-void D_move_abs_clip(double, double);
-int D_cont_abs_clip(double, double);
-int D_line_abs_clip(double, double, double, double);
 void D_polydots_clip(const double *, const double *, int);
-void D_polyline_cull(const double *, const double *, int);
 void D_polyline_clip(const double *, const double *, int);
-void D_polygon_cull(const double *, const double *, int);
 void D_polygon_clip(const double *, const double *, int);
 void D_box_clip(double, double, double, double);
-void D_move(double, double);
-void D_cont(double, double);
+
+void D_move_abs(double, double);
+void D_move_rel(double, double);
+void D_cont_abs(double, double);
+void D_cont_rel(double, double);
 void D_line(double, double, double, double);
 void D_polydots(const double *, const double *, int);
 void D_polyline(const double *, const double *, int);
 void D_polygon(const double *, const double *, int);
 void D_box(double, double, double, double);
-void D_line_width(double);
-void D_move_abs(double, double);
-void D_cont_abs(double, double);
-void D_line_abs(double, double, double, double);
 
 /* icon.c */
 void D_plot_icon(double, double, int, double, double);
@@ -110,9 +143,6 @@
 int D_color_number_to_RGB(int, int *, int *, int *);
 
 /* window.c */
-void D_set_window(double, double, double, double);
-void D_get_screen_window(double *, double *, double *, double *);
-void D_check_map_window(struct Cell_head *);
 void D_erase(const char *);
 
 #endif /* GRASS_DISPLAY_H */

Modified: grass/trunk/lib/display/cnversions.c
===================================================================
--- grass/trunk/lib/display/cnversions.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/lib/display/cnversions.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -1,3 +1,4 @@
+#include <math.h>
 #include <grass/gis.h>
 #include <grass/display.h>
 
@@ -23,31 +24,32 @@
  *  conversion coefficients are alos provided.
  */
 
+struct vector
+{
+    double x, y;
+};
+
 struct rectangle
 {
     double west;
     double east;
     double south;
     double north;
+    struct vector size;
 };
 
-struct vector
-{
-    double x, y;
-};
-
 /* Bounding rectangles */
+static struct rectangle D;	/* Display coordinates, pixels, (0,0) towards NW */
+static struct rectangle A;	/* Map array coordinates, integers, (0,0) towards NW */
 static struct rectangle U;	/* UTM coordinates, meters, (0,0) towards SW */
-static struct rectangle A;	/* Map array coordinates, integers, (0,0) towards NW */
-static struct rectangle D;	/* Display coordinates, pixels, (0,0) towards NW */
 
 /* Conversion factors */
+static struct vector D_to_A_conv;	/* Display to Array */
+static struct vector A_to_U_conv;	/* Array to UTM     */
 static struct vector U_to_D_conv;	/* UTM to Display   */
-static struct vector D_to_A_conv;	/* Display to Array */
 
 /* others */
 static int is_lat_lon;
-static struct vector resolution;
 
 /*!
  * \brief initialize conversions
@@ -66,76 +68,58 @@
  *  \return int
  */
 
-int D_do_conversions(const struct Cell_head *window,
-		     double t, double b, double l, double r)
+static void calc_size(struct rectangle *rect)
 {
-    struct vector ARRAY_SIZE;
-    struct rectangle WIND;
-    struct vector D_size, U_size;
+    rect->size.x = rect->east  - rect->west;
+    rect->size.y = rect->south - rect->north;
+}
 
-    WIND.north = t;
-    WIND.south = b;
-    WIND.west  = l;
-    WIND.east  = r;
+static void calc_conv(struct vector *conv, 
+		      const struct vector *src, const struct vector *dst)
+{
+    conv->x = dst->x / src->x;
+    conv->y = dst->y / src->y;
+}
 
-    is_lat_lon = (window->proj == PROJECTION_LL);
+static void fit_aspect(struct rectangle *rect, const struct rectangle *ref)
+{
+    struct vector conv;
+    double scale, size, delta;
 
-    resolution.y = window->ns_res;
-    resolution.x = window->ew_res;
+    calc_conv(&conv, &rect->size, &ref->size);
 
-    /* Key all coordinate limits off UTM window limits  */
-    U.west = window->west;
-    U.east = window->east;
-    U.south = window->south;
-    U.north = window->north;
-
-    U_size.y = U.north - U.south;
-    U_size.x = U.east - U.west;
-
-    D_size.x = WIND.east - WIND.west;
-    D_size.y = WIND.south - WIND.north;
-
-    U_to_D_conv.x = D_size.x / U_size.x;
-    U_to_D_conv.y = D_size.y / U_size.y;
-
-    if (U_to_D_conv.x > U_to_D_conv.y) {
-	U_to_D_conv.x = U_to_D_conv.y;
-	D.west =
-	    (double)(int)((WIND.west + WIND.east -
-			   U_size.x * U_to_D_conv.x) / 2);
-	D.east =
-	    (double)(int)((WIND.west + WIND.east +
-			   U_size.x * U_to_D_conv.x) / 2);
-	D.north = WIND.north;
-	D.south = WIND.south;
+    if (fabs(conv.y) > fabs(conv.x)) {
+	scale = fabs(conv.y) / fabs(conv.x);
+	size = rect->size.x * scale;
+	delta = rect->size.x - size;
+	rect->west -= delta/2;
+	rect->east += delta/2;
+	rect->size.x = size;
     }
     else {
-	U_to_D_conv.y = U_to_D_conv.x;
-	D.west = WIND.west;
-	D.east = WIND.east;
-	D.north =
-	    (double)(int)((WIND.north + WIND.south -
-			   U_size.y * U_to_D_conv.y) / 2);
-	D.south =
-	    (double)(int)((WIND.north + WIND.south +
-			   U_size.y * U_to_D_conv.y) / 2);
+	scale = fabs(conv.x) / fabs(conv.y);
+	size = rect->size.y * scale;
+	delta = rect->size.y - size;
+	rect->north -= delta/2;
+	rect->south += delta/2;
+	rect->size.y = size;
     }
+}
 
-    D_size.x = D.east - D.west;
-    D_size.y = D.south - D.north;
+void D_update_conversions(void)
+{
+    calc_conv(&D_to_A_conv, &D.size, &A.size);
+    calc_conv(&A_to_U_conv, &A.size, &U.size);
+    calc_conv(&U_to_D_conv, &U.size, &D.size);
+}
 
-    ARRAY_SIZE.x = (double)window->cols;
-    ARRAY_SIZE.y = (double)window->rows;
+void D_fit_d_to_u(void)
+{
+    fit_aspect(&D, &U);
+}
 
-    A.west  = 0.0;
-    A.north = 0.0;
-    A.east  = ARRAY_SIZE.x;
-    A.south = ARRAY_SIZE.y;
-
-    D_to_A_conv.x = ARRAY_SIZE.x / D_size.x;
-    D_to_A_conv.y = ARRAY_SIZE.y / D_size.y;
-
-#ifdef DEBUG
+void D_show_conversions(void)
+{
     fprintf(stderr,
 	    " D_w %10.1f  D_e %10.1f  D_s %10.1f  D_n %10.1f\n",
 	    D.west, D.east, D.south, D.north);
@@ -145,93 +129,124 @@
     fprintf(stderr,
 	    " U_w %10.1f  U_e %10.1f  U_s %10.1f  U_n %10.1f\n",
 	    U.west, U.east, U.south, U.north);
+
     fprintf(stderr,
-	    " ARRAY_ROWS %d  resolution_ns %10.2f\n", (int)ARRAY_SIZE.y,
-	    window->ns_res);
-    fprintf(stderr, " ARRAY_COLS %d  resolution_ew %10.2f\n", (int)ARRAY_SIZE.x,
-	    window->ew_res);
+	    " D_x %10.1f  D_y %10.1f\n" "\n", D.size.x, D.size.y);
+    fprintf(stderr,
+	    " A_x %10.1f  A_y %10.1f\n" "\n", A.size.x, A.size.y);
+    fprintf(stderr,
+	    " U_x %10.1f  U_y %10.1f\n" "\n", U.size.x, U.size.y);
+
     fprintf(stderr, " D_to_A_conv.x %10.1f D_to_A_conv.y %10.1f \n",
 	    D_to_A_conv.x, D_to_A_conv.y);
-    fprintf(stderr, " BOT %10.1f  TOP %10.1f  LFT %10.1f  RHT %10.1f\n",
-	    WIND.south, WIND.north, WIND.west, WIND.east);
-#endif /* DEBUG */
-
-    return (0);
+    fprintf(stderr, " A_to_U_conv.x %10.1f A_to_U_conv.y %10.1f \n",
+	    A_to_U_conv.x, A_to_U_conv.y);
+    fprintf(stderr, " U_to_D_conv.x %10.1f U_to_D_conv.y %10.1f \n",
+	    U_to_D_conv.x, U_to_D_conv.y);
 }
 
-int D_is_lat_lon(void)
+void D_do_conversions(const struct Cell_head *window,
+		      double t, double b, double l, double r)
 {
-    return (is_lat_lon);
+    D_set_region(window);
+    D_set_dst(t, b, l, r);
+    D_fit_d_to_u();
+    D_update_conversions();
+#ifdef DEBUG
+    D_show_conversions();
+#endif /* DEBUG */
 }
 
-double D_get_ns_resolution(void)
+int D_is_lat_lon(void)			{    return (is_lat_lon);		}
+
+double D_get_d_to_a_xconv(void)		{    return (D_to_A_conv.x);		}
+double D_get_d_to_a_yconv(void)		{    return (D_to_A_conv.y);		}
+double D_get_d_to_u_xconv(void)		{    return (1/U_to_D_conv.x);		}
+double D_get_d_to_u_yconv(void)		{    return (1/U_to_D_conv.y);		}
+double D_get_a_to_u_xconv(void)		{    return (A_to_U_conv.x);		}
+double D_get_a_to_u_yconv(void)		{    return (A_to_U_conv.y);		}
+double D_get_a_to_d_xconv(void)		{    return (1/D_to_A_conv.x);		}
+double D_get_a_to_d_yconv(void)		{    return (1/D_to_A_conv.y);		}
+double D_get_u_to_d_xconv(void)		{    return (U_to_D_conv.x);		}
+double D_get_u_to_d_yconv(void)		{    return (U_to_D_conv.y);		}
+double D_get_u_to_a_xconv(void)		{    return (1/A_to_U_conv.x);		}
+double D_get_u_to_a_yconv(void)		{    return (1/A_to_U_conv.y);		}
+
+double D_get_ns_resolution(void)	{    return D_get_a_to_u_yconv();	}
+double D_get_ew_resolution(void)	{    return D_get_a_to_u_xconv();	}
+
+double D_get_u_west(void)		{    return (U.west);			}
+double D_get_u_east(void)		{    return (U.east);			}
+double D_get_u_north(void)		{    return (U.north);			}
+double D_get_u_south(void)		{    return (U.south);			}
+
+double D_get_a_west(void)		{    return (A.west);			}
+double D_get_a_east(void)		{    return (A.east);			}
+double D_get_a_north(void)		{    return (A.north);			}
+double D_get_a_south(void)		{    return (A.south);			}
+
+double D_get_d_west(void)		{    return (D.west);			}
+double D_get_d_east(void)		{    return (D.east);			}
+double D_get_d_north(void)		{    return (D.north);			}
+double D_get_d_south(void)		{    return (D.south);			}
+
+void D_set_region(const struct Cell_head *window)
 {
-    return (resolution.y);
+    D_set_src(window->north, window->south, window->west, window->east);
+    D_set_grid(0, window->rows, 0, window->cols);
+    is_lat_lon = (window->proj == PROJECTION_LL);
 }
-double D_get_ew_resolution(void)
+
+void D_set_src(double t, double b, double l, double r)
 {
-    return (resolution.x);
+    U.north = t;
+    U.south = b;
+    U.west  = l;
+    U.east  = r;
+    calc_size(&U);
 }
 
-double D_get_u_to_d_xconv(void)
+void D_get_src(double *t, double *b, double *l, double *r)
 {
-    return (U_to_D_conv.x);
+    *t = U.north;
+    *b = U.south;
+    *l = U.west;
+    *r = U.east;
 }
-double D_get_u_to_d_yconv(void)
+
+void D_set_grid(int t, int b, int l, int r)
 {
-    return (U_to_D_conv.y);
+    A.north = t;
+    A.south = b;
+    A.west  = l;
+    A.east  = r;
+    calc_size(&A);
 }
 
-double D_get_u_west(void)
+void D_get_grid(int *t, int *b, int *l, int *r)
 {
-    return (U.west);
+    *t = A.north;
+    *b = A.south;
+    *l = A.west;
+    *r = A.east;
 }
-double D_get_u_east(void)
-{
-    return (U.east);
-}
-double D_get_u_north(void)
-{
-    return (U.north);
-}
-double D_get_u_south(void)
-{
-    return (U.south);
-}
 
-double D_get_a_west(void)
+void D_set_dst(double t, double b, double l, double r)
 {
-    return (A.west);
+    D.north = t;
+    D.south = b;
+    D.west  = l;
+    D.east  = r;
+    calc_size(&D);
 }
-double D_get_a_east(void)
-{
-    return (A.east);
-}
-double D_get_a_north(void)
-{
-    return (A.north);
-}
-double D_get_a_south(void)
-{
-    return (A.south);
-}
 
-double D_get_d_west(void)
+void D_get_dst(double *t, double *b, double *l, double *r)
 {
-    return (D.west);
+    *t = D.north;
+    *b = D.south;
+    *l = D.west;
+    *r = D.east;
 }
-double D_get_d_east(void)
-{
-    return (D.east);
-}
-double D_get_d_north(void)
-{
-    return (D.north);
-}
-double D_get_d_south(void)
-{
-    return (D.south);
-}
 
 void D_get_u(double x[2][2])
 {
@@ -269,7 +284,7 @@
 
 double D_u_to_a_row(double U_row)
 {
-    return (U.north - U_row) / resolution.y;
+    return A.north + (U_row - U.north) / A_to_U_conv.y;
 }
 
 
@@ -285,7 +300,7 @@
 
 double D_u_to_a_col(double U_col)
 {
-    return (U_col - U.west) / resolution.x;
+    return A.west + (U_col - U.west) / A_to_U_conv.x;
 }
 
 
@@ -334,7 +349,7 @@
 
 double D_u_to_d_row(double U_row)
 {
-    return D.north + (U.north - U_row) * U_to_D_conv.y;
+    return D.north + (U_row - U.north) * U_to_D_conv.y;
 }
 
 
@@ -366,7 +381,7 @@
 
 double D_d_to_u_row(double D_row)
 {
-    return U.north - (D_row - D.north) / U_to_D_conv.y;
+    return U.north + (D_row - D.north) / U_to_D_conv.y;
 }
 
 

Modified: grass/trunk/lib/display/draw2.c
===================================================================
--- grass/trunk/lib/display/draw2.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/lib/display/draw2.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -82,30 +82,37 @@
     yf = NULL;
 }
 
-static int do_convert(const double *x, const double *y, int n)
+static int do_reduce(double *x, double *y, int n)
 {
     static double eps = 0.5;
     int i, j;
 
-    alloc_dst(n);
-
-    for (i = 0; i < n; i++) {
-	xi[i] = D_u_to_d_col(x[i]);
-	yi[i] = D_u_to_d_row(y[i]);
-    }
-
     for (i = 0, j = 1; j < n; j++) {
-	if (fabs(xi[j] - xi[i]) < eps && fabs(yi[j] - yi[i]) < eps)
+	if (fabs(x[j] - x[i]) < eps && fabs(y[j] - y[i]) < eps)
 	    continue;
 	i++;
 	if (i == j)
 	    continue;
-	xi[i] = xi[j];
-	yi[i] = yi[j];
+	x[i] = x[j];
+	y[i] = y[j];
     }
     return i + 1;
 }
 
+static int do_convert(const double *x, const double *y, int n)
+{
+    int i;
+
+    alloc_dst(n);
+
+    for (i = 0; i < n; i++) {
+	xi[i] = D_u_to_d_col(x[i]);
+	yi[i] = D_u_to_d_row(y[i]);
+    }
+
+    return do_reduce(xi, yi, n);
+}
+
 static double dist_plane(double x, double y, const struct plane *p)
 {
     return x * p->x + y * p->y + p->k;
@@ -283,86 +290,21 @@
  * current database region. This is the default.
  *
  *  \param ~
- *  \return void
  */
 
-void D_clip_to_display(void)
+void D_clip_to_map(void)
 {
-    D_set_clip(D_get_d_north(), D_get_d_south(),
-	       D_get_d_west(), D_get_d_east());
-}
-
-/*!
- * \brief set clipping window to screen window
- *
- * Sets the clipping window to the pixel window that corresponds to the
- * full screen window. Off screen rendering is still clipped.
- *
- *  \param ~
- *  \return int
- */
-
-void D_clip_to_screen(void)
-{
     double t, b, l, r;
 
-    D_get_screen_window(&t, &b, &l, &r);
+    D_get_src(&t, &b, &l, &r);
     D_set_clip(t, b, l, r);
 }
 
-
-/*!
- * \brief set clipping window to map window
- *
- * Sets the clipping window to the pixel window that corresponds to the
- * current database region. This is the default.
- *
- *  \param ~
- */
-
-void D_clip_to_map(void)
+void D_line_width(double d)
 {
-    D_set_clip(D_get_u_north(), D_get_u_south(),
-	       D_get_u_west(), D_get_u_east());
+    R_line_width(d > 0 ? d : 0);
 }
 
-/*!
- * \brief move to pixel
- *
- * Move without drawing to
- * pixel location <b>x,y</b>, even if it falls outside the clipping window.
- *
- *  \param x
- *  \param y
- */
-
-void D_move_clip(double x, double y)
-{
-    cur.x = x;
-    cur.y = y;
-}
-
-void D_move_abs_clip(double x, double y)
-{
-    cur.x = x;
-    cur.y = y;
-}
-
-/*!
- * \brief line to x,y
- *
- * Draws a line from the
- * current position to pixel location <b>x,y.</b> Any part of the line that
- * falls outside the clipping window is not drawn.
- * <b>Note.</b> The new position is <b>x,y</b>, even if it falls outside the
- * clipping window. Returns 0 if the line was contained entirely in the clipping
- * window, 1 if the line had to be clipped to draw it.
- *
- *  \param x
- *  \param y
- *  \return int
- */
-
 static int line_clip(double x1, double y1, double x2, double y2)
 {
     struct vector a, b;
@@ -413,109 +355,6 @@
     return ret;
 }
 
-static int line_clip_abs(double x1, double y1, double x2, double y2)
-{
-    struct vector a, b;
-    int clipped;
-
-    a.x = x1;
-    a.y = y1;
-
-    b.x = x2;
-    b.y = y2;
-
-    clipped = do_clip(&a, &b);
-
-    if (clipped >= 0) {
-	double x1 = a.x;
-	double y1 = a.y;
-	double x2 = b.x;
-	double y2 = b.y;
-
-	R_move_abs(x1, y1);
-	R_cont_abs(x2, y2);
-    }
-
-    return clipped;
-}
-
-int D_cont_clip(double x, double y)
-{
-    int ret;
-
-    if (!window_set)
-	D_clip_to_map();
-
-    if (D_is_lat_lon())
-	ret = line_clip_ll(cur.x, cur.y, x, y);
-    else
-	ret = line_clip(cur.x, cur.y, x, y);
-
-    cur.x = x;
-    cur.y = y;
-
-    return ret;
-}
-
-int D_line_clip(double x1, double y1, double x2, double y2)
-{
-    D_move_clip(x1, y1);
-    return D_cont_clip(x2, y2);
-}
-
-int D_cont_abs_clip(double x, double y)
-{
-    int ret;
-
-    if (!window_set)
-	D_clip_to_display();
-
-    ret = line_clip_abs(cur.x, cur.y, x, y);
-
-    cur.x = x;
-    cur.y = y;
-
-    return ret;
-}
-
-int D_line_abs_clip(double x1, double y1, double x2, double y2)
-{
-    D_move_abs_clip(x1, y1);
-    return D_cont_abs_clip(x2, y2);
-}
-
-void D_polydots_clip(const double *x, const double *y, int n)
-{
-    double ux0 = clip.left;
-    int i, j;
-
-    if (!window_set)
-	D_clip_to_map();
-
-    alloc_src(n);
-
-    for (i = j = 0; i < n; i++) {
-	double xx = x[i];
-	double yy = y[i];
-
-	if (D_is_lat_lon())
-	    xx -= shift_angle(x[i] - ux0);
-
-	if (xx < clip.left || xx > clip.rite)
-	    continue;
-	if (yy < clip.bot || yy > clip.top)
-	    continue;
-
-	xf[j] = xx;
-	yf[j] = yy;
-	j++;
-    }
-
-    n = do_convert(xf, yf, n);
-
-    R_polydots_abs(xi, yi, j);
-}
-
 static int cull_polyline_plane(int *pn, const double *x, const double *y,
 			       const struct plane *p)
 {
@@ -590,20 +429,6 @@
     R_polyline_abs(xi, yi, n);
 }
 
-void D_polyline_cull(const double *x, const double *y, int n)
-{
-    if (n < 2)
-	return;
-
-    if (!window_set)
-	D_clip_to_map();
-
-    if (D_is_lat_lon())
-	do_ll_wrap(x, y, n, polyline_cull);
-    else
-	polyline_cull(x, y, n);
-}
-
 static void polyline_clip(const double *x, const double *y, int n)
 {
     int i;
@@ -612,20 +437,6 @@
 	line_clip(x[i - 1], y[i - 1], x[i], y[i]);
 }
 
-void D_polyline_clip(const double *x, const double *y, int n)
-{
-    if (n < 2)
-	return;
-
-    if (!window_set)
-	D_clip_to_map();
-
-    if (D_is_lat_lon())
-	do_ll_wrap(x, y, n, polyline_clip);
-    else
-	polyline_clip(x, y, n);
-}
-
 static int cull_polygon_plane(int *pn, const double *x, const double *y,
 			      const struct plane *p)
 {
@@ -700,17 +511,6 @@
     R_polygon_abs(xi, yi, n);
 }
 
-void D_polygon_cull(const double *x, const double *y, int n)
-{
-    if (!window_set)
-	D_clip_to_map();
-
-    if (D_is_lat_lon())
-	do_ll_wrap(x, y, n, polygon_cull);
-    else
-	polygon_cull(x, y, n);
-}
-
 static int clip_polygon_plane(int *pn, const double *x, const double *y,
 			      const struct plane *p)
 {
@@ -780,37 +580,57 @@
     R_polygon_abs(xi, yi, n);
 }
 
-void D_polygon_clip(const double *x, const double *y, int n)
+static void box_clip(double x1, double y1, double x2, double y2)
 {
-    if (!window_set)
-	D_clip_to_map();
+    x1 = max(clip.left, min(clip.rite, x1));
+    x2 = max(clip.left, min(clip.rite, x2));
+    y1 = max(clip.top, min(clip.bot, y1));
+    y2 = max(clip.top, min(clip.bot, y2));
 
-    if (D_is_lat_lon())
-	do_ll_wrap(x, y, n, polygon_clip);
-    else
-	polygon_clip(x, y, n);
+    x1 = D_u_to_d_col(x1);
+    x2 = D_u_to_d_col(x2);
+    y1 = D_u_to_d_row(y1);
+    y2 = D_u_to_d_row(y2);
+
+    R_box_abs(x1, y1, x2, y2);
 }
 
-static void box_clip(double x1, double y1, double x2, double y2)
+static void box_clip_ll(double x1, double y1, double x2, double y2)
 {
-    double t, b, l, r;
-    double ti, bi, li, ri;
+    double ux0 = clip.left;
+    double ux1 = clip.rite;
+    int lo, hi, i;
 
-    l = max(clip.left, min(x1, x2));
-    r = min(clip.rite, max(x1, x2));
-    b = max(clip.bot, min(y1, y2));
-    t = min(clip.top, max(y1, y2));
+    x2 = x1 + coerce(x2 - x1);
 
-    li = D_u_to_d_col(l);
-    ri = D_u_to_d_col(r);
-    bi = D_u_to_d_row(b);
-    ti = D_u_to_d_row(t);
+    lo = -shift_count(ux1 - x1);
+    hi = shift_count(x2 - ux0);
 
-    R_box_abs(li, ti, ri, bi);
+    for (i = lo; i <= hi; i++)
+	box_clip(x1 + i * 360, y1, x2 + i * 360, y2);
 }
 
-static void box_clip_ll(double x1, double y1, double x2, double y2)
+static void box_cull(double x1, double y1, double x2, double y2)
 {
+    if (x1 > clip.rite && x2 > clip.rite)
+	return;
+    if (x1 < clip.left && x2 < clip.left)
+	return;
+    if (y1 > clip.bot && y2 > clip.bot)
+	return;
+    if (y1 < clip.top && y2 < clip.top)
+	return;
+
+    x1 = D_u_to_d_col(x1);
+    y1 = D_u_to_d_row(y1);
+    x2 = D_u_to_d_col(x2);
+    y2 = D_u_to_d_row(y2);
+
+    R_box_abs(x1, y1, x2, y2);
+}
+
+static void box_cull_ll(double x1, double y1, double x2, double y2)
+{
     double ux0 = clip.left;
     double ux1 = clip.rite;
     int lo, hi, i;
@@ -824,51 +644,261 @@
 	box_clip(x1 + i * 360, y1, x2 + i * 360, y2);
 }
 
-void D_box_clip(double x1, double y1, double x2, double y2)
+static void polydots_cull(const double *x, const double *y, int n)
 {
+    double ux0 = clip.left;
+    int i, j;
+
+    alloc_src(n);
+
+    for (i = j = 0; i < n; i++) {
+	double xx = x[i];
+	double yy = y[i];
+
+	if (D_is_lat_lon())
+	    xx -= shift_angle(x[i] - ux0);
+
+	if (xx < clip.left || xx > clip.rite)
+	    continue;
+	if (yy < clip.bot || yy > clip.top)
+	    continue;
+
+	xf[j] = xx;
+	yf[j] = yy;
+	j++;
+    }
+
+    n = do_convert(xf, yf, n);
+
+    R_polydots_abs(xi, yi, j);
+}
+
+static int line_cull(double x1, double y1, double x2, double y2)
+{
+    if (x1 > clip.rite && x2 > clip.rite)
+	return 1;
+    if (x1 < clip.left && x2 < clip.left)
+	return 1;
+    if (y1 > clip.bot && y2 > clip.bot)
+	return 1;
+    if (y1 < clip.top && y2 < clip.top)
+	return 1;
+
+    x1 = D_u_to_d_col(x1);
+    y1 = D_u_to_d_row(y1);
+    x2 = D_u_to_d_col(x2);
+    y2 = D_u_to_d_row(y2);
+
+    R_move_abs(x1, y1);
+    R_cont_abs(x2, y2);
+
+    return 0;
+}
+
+static int line_cull_ll(double ax, double ay, double bx, double by)
+{
+    double ux0 = clip.left;
+    double ux1 = clip.rite;
+    double x0, x1;
+    int lo, hi, i;
+    int ret;
+
+    bx = ax + coerce(bx - ax);
+
+    x0 = min(ax, bx);
+    x1 = max(ax, bx);
+
+    lo = -shift_count(ux1 - x0);
+    hi = shift_count(x1 - ux0);
+
+    ret = 1;
+
+    for (i = lo; i <= hi; i++)
+	ret &= line_cull(ax + i * 360, ay, bx + i * 360, by);
+
+    return ret;
+}
+
+int D_cont_abs_cull(double x, double y)
+{
+    int ret;
+
     if (!window_set)
 	D_clip_to_map();
 
     if (D_is_lat_lon())
-	box_clip_ll(x1, y1, x2, y2);
+	ret = line_cull_ll(cur.x, cur.y, x, y);
     else
-	box_clip(x1, y1, x2, y2);
+	ret = line_cull(cur.x, cur.y, x, y);
+
+    cur.x = x;
+    cur.y = y;
+
+    return ret;
 }
 
-void D_move(double x, double y)
+int D_cont_rel_cull(double x, double y)
 {
-    double dx = D_u_to_d_col(x);
-    double dy = D_u_to_d_row(y);
+    return D_cont_abs_cull(cur.x + x, cur.y + y);
+}
 
-    R_move_abs(dx, dy);
+int D_line_cull(double x1, double y1, double x2, double y2)
+{
+    D_move_abs(x1, y1);
+    return D_cont_abs_cull(x2, y2);
 }
 
-void D_cont(double x, double y)
+void D_polydots_cull(const double *x, const double *y, int n)
 {
-    double dx = D_u_to_d_col(x);
-    double dy = D_u_to_d_row(y);
+    if (!window_set)
+	D_clip_to_map();
 
-    R_cont_abs(dx, dy);
+    polydots_cull(x, y, n);
 }
 
-void D_line(double x1, double y1, double x2, double y2)
+void D_polyline_cull(const double *x, const double *y, int n)
 {
-    D_move(x1, y1);
-    D_cont(x2, y2);
+    if (n < 2)
+	return;
+
+    if (!window_set)
+	D_clip_to_map();
+
+    if (D_is_lat_lon())
+	do_ll_wrap(x, y, n, polyline_cull);
+    else
+	polyline_cull(x, y, n);
 }
 
+void D_polygon_cull(const double *x, const double *y, int n)
+{
+    if (!window_set)
+	D_clip_to_map();
+
+    if (D_is_lat_lon())
+	do_ll_wrap(x, y, n, polygon_cull);
+    else
+	polygon_cull(x, y, n);
+}
+
+void D_box_cull(double x1, double y1, double x2, double y2)
+{
+    if (!window_set)
+	D_clip_to_map();
+
+    if (D_is_lat_lon())
+	box_cull_ll(x1, y1, x2, y2);
+    else
+	box_cull(x1, y1, x2, y2);
+}
+
+int D_cont_abs_clip(double x, double y)
+{
+    int ret;
+
+    if (!window_set)
+	D_clip_to_map();
+
+    if (D_is_lat_lon())
+	ret = line_clip_ll(cur.x, cur.y, x, y);
+    else
+	ret = line_clip(cur.x, cur.y, x, y);
+
+    cur.x = x;
+    cur.y = y;
+
+    return ret;
+}
+
+int D_cont_rel_clip(double x, double y)
+{
+    return D_cont_abs_clip(cur.x + x, cur.y + y);
+}
+
+int D_line_clip(double x1, double y1, double x2, double y2)
+{
+    D_move_abs(x1, y1);
+    return D_cont_abs_clip(x2, y2);
+}
+
+void D_polydots_clip(const double *x, const double *y, int n)
+{
+    if (!window_set)
+	D_clip_to_map();
+
+    polydots_cull(x, y, n);
+}
+
+void D_polyline_clip(const double *x, const double *y, int n)
+{
+    if (!window_set)
+	D_clip_to_map();
+
+    if (n < 2)
+	return;
+
+    if (D_is_lat_lon())
+	do_ll_wrap(x, y, n, polyline_clip);
+    else
+	polyline_clip(x, y, n);
+}
+
+void D_polygon_clip(const double *x, const double *y, int n)
+{
+    if (!window_set)
+	D_clip_to_map();
+
+    if (D_is_lat_lon())
+	do_ll_wrap(x, y, n, polygon_clip);
+    else
+	polygon_clip(x, y, n);
+}
+
+void D_box_clip(double x1, double y1, double x2, double y2)
+{
+    if (!window_set)
+	D_clip_to_map();
+
+    if (D_is_lat_lon())
+	box_clip_ll(x1, y1, x2, y2);
+    else
+	box_clip(x1, y1, x2, y2);
+}
+
 void D_move_abs(double x, double y)
 {
+    cur.x = x;
+    cur.y = y;
+
+    x = D_u_to_d_col(x);
+    y = D_u_to_d_row(y);
+
     R_move_abs(x, y);
 }
 
+void D_move_rel(double x, double y)
+{
+    D_move_abs(cur.x + x, cur.y + y);
+}
+
 void D_cont_abs(double x, double y)
 {
+    cur.x = x;
+    cur.y = y;
+
+    x = D_u_to_d_col(x);
+    y = D_u_to_d_row(y);
+
     R_cont_abs(x, y);
 }
 
-void D_line_abs(double x1, double y1, double x2, double y2)
+void D_cont_rel(double x, double y)
 {
+    D_cont_abs(cur.x + x, cur.y + y);
+}
+
+void D_line(double x1, double y1, double x2, double y2)
+{
     D_move_abs(x1, y1);
     D_cont_abs(x2, y2);
 }
@@ -893,20 +923,11 @@
 
 void D_box(double x1, double y1, double x2, double y2)
 {
-    double l = min(x1, x2);
-    double r = max(x1, x2);
-    double b = min(y1, y2);
-    double t = max(y1, y2);
-    double li = D_u_to_d_col(l);
-    double ri = D_u_to_d_col(r);
-    double bi = D_u_to_d_row(b);
-    double ti = D_u_to_d_row(t);
+    x1 = D_u_to_d_col(x1);
+    x2 = D_u_to_d_col(x2);
+    y1 = D_u_to_d_row(y1);
+    y2 = D_u_to_d_row(y2);
 
-    R_box_abs(li, ti, ri, bi);
+    R_box_abs(x1, y1, x2, y2);
 }
 
-void D_line_width(double d)
-{
-    R_line_width(d > 0 ? d : 0);
-}
-

Modified: grass/trunk/lib/display/icon.c
===================================================================
--- grass/trunk/lib/display/icon.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/lib/display/icon.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -26,8 +26,7 @@
 	double tx1 = m[0][0] * x1 + m[0][1] * y1 + m[0][2];
 	double ty1 = m[1][0] * x1 + m[1][1] * y1 + m[1][2];
 
-	D_move(tx0, ty0);
-	D_cont(tx1, ty1);
+	D_line(tx0, ty0, tx1, ty1);
 }
 
 /**

Modified: grass/trunk/lib/display/raster.c
===================================================================
--- grass/trunk/lib/display/raster.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/lib/display/raster.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -3,7 +3,7 @@
  *
  * D_cell_draw_setup(t, b, l, r)
  *    int t, b, l, r    (pixle extents of display window)
- *                      (obtainable via D_get_screen_window(&t, &b, &l, &r)
+ *                      (obtainable via D_get_dst(&t, &b, &l, &r)
  *   Sets up the environment for D_draw_cell
  *
  * D_draw_cell(A_row, xarray, colors)
@@ -121,7 +121,7 @@
  * The raster display subsystem establishes
  * conversion parameters based on the screen extent defined by <b>top,
  * bottom, left</b>, and <b>right</b>, all of which are obtainable from
- * <i>D_get_screen_window for the current frame.</i>
+ * <i>D_get_dst for the current frame.</i>
  *
  *  \param top
  *  \param bottom
@@ -136,9 +136,9 @@
 
     if (G_get_set_window(&window) == -1)
 	G_fatal_error("Current window not available");
-    if (D_do_conversions(&window, t, b, l, r))
-	G_fatal_error("Error in calculating conversions");
 
+    D_do_conversions(&window, t, b, l, r);
+
     /* Set up the screen for drawing map */
     D_get_a(src);
     D_get_d(dst);

Modified: grass/trunk/lib/display/setup.c
===================================================================
--- grass/trunk/lib/display/setup.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/lib/display/setup.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -61,7 +61,7 @@
     struct Cell_head region;
     double t, b, l, r;
 
-    D_get_screen_window(&t, &b, &l, &r);
+    R_get_window(&t, &b, &l, &r);
 
     /* clear the frame, if requested to do so */
     if (clear)
@@ -69,14 +69,9 @@
 
     /* Set the map region associated with graphics frame */
     G_get_set_window(&region);
-    D_check_map_window(&region);
     if (G_set_window(&region) < 0)
 	G_fatal_error("Invalid graphics coordinates");
 
     /* Determine conversion factors */
-    if (D_do_conversions(&region, t, b, l, r))
-	G_fatal_error("Error calculating graphics-region conversions");
-
-    /* set text clipping, for good measure */
-    R_set_window(t, b, l, r);
+    D_do_conversions(&region, t, b, l, r);
 }

Modified: grass/trunk/lib/display/window.c
===================================================================
--- grass/trunk/lib/display/window.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/lib/display/window.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -1,22 +1,5 @@
 /*
- * D_new_window(name, t, b, l, r)
- *   creates a new window with given coordinates
- *   if "name" is an empty string, the routine returns a unique
- *   string in "name"
- *
- * D_show_window(color)
- *   outlines current window in color (from ../colors.h)
- *
- * D_get_screen_window(t, b, l, r)
- *   returns current window's coordinates 
- *
- * D_check_map_window(wind)
- *   if map window (m_win) already assigned
- *       map window is read into the struct "wind"
- *   else
- *       struct "wind" is written to map window (m_win)
- *
- * D_erase_window()
+ * D_erase()
  *   Erases the window on scree.  Does not affect window contents list.
  */
 
@@ -26,93 +9,12 @@
 #include <grass/display.h>
 #include <grass/raster.h>
 
-static struct {
-    double t, b, l, r;
-} screen_window;
-static int screen_window_set;
-
-static struct Cell_head map_window;
-static int map_window_set;
-
-void D_set_window(double t, double b, double l, double r)
-{
-    screen_window.t = t;
-    screen_window.b = b;
-    screen_window.l = l;
-    screen_window.r = r;
-    screen_window_set = 1;
-    R_set_window(t, b, l, r);
-}
-
-/*!
- * \brief retrieve current frame coordinates
- *
- * Returns current frame's
- * coordinates in the pointers <b>top, bottom, left</b>, and <b>right.</b>
- *
- *  \param top
- *  \param bottom
- *  \param left
- *  \param right
- *  \return int
- */
-
-void D_get_screen_window(double *t, double *b, double *l, double *r)
-{
-    if (!screen_window_set) {
-	R_get_window(
-	    &screen_window.t, &screen_window.b,
-	    &screen_window.l, &screen_window.r);
-	screen_window_set = 1;
-    }
-
-    *t = screen_window.t;
-    *b = screen_window.b;
-    *l = screen_window.l;
-    *r = screen_window.r;
-}
-
-
-/*!
- * \brief assign/retrieve current map region
- *
- * Graphics frames can have GRASS map regions associated with
- * them. This routine passes the map <b>region</b> to the current graphics
- * frame. If a GRASS region is already associated with the graphics frame, its
- * information is copied into <b>region</b> for use by the calling module.
- * Otherwise <b>region</b> is associated with the current graphics frame.
- * Note this routine is called by <i>D_setup.</i>
- *
- *  \param region
- *  \return void
- */
-
-void D_check_map_window(struct Cell_head *wind)
-{
-    if (map_window_set)
-	*wind = map_window;
-    else
-    {
-	map_window = *wind;
-	map_window_set = 1;
-    }
-}
-
-/*!
- * \brief erase current frame
- *
- * Erases the frame on the
- * screen using the currently selected color.
- *
- *  \param ~
- */
-
 void D_erase(const char *color)
 {
     double t, b, l, r;
     int colorindex;
 
-    D_get_screen_window(&t, &b, &l, &r);
+    D_get_dst(&t, &b, &l, &r);
 
     /* Parse and select background color */
     colorindex = D_parse_color(color, 0);

Modified: grass/trunk/vector/v.digit/driver.c
===================================================================
--- grass/trunk/vector/v.digit/driver.c	2008-08-24 19:07:58 UTC (rev 33050)
+++ grass/trunk/vector/v.digit/driver.c	2008-08-24 19:12:11 UTC (rev 33051)
@@ -103,8 +103,7 @@
 	G_fatal_error("Invalid graphics coordinates");
 
     /* Determine conversion factors */
-    if (D_do_conversions(&region, t, b, l, r))
-	G_fatal_error("Error calculating graphics-region conversions");
+    D_do_conversions(&region, t, b, l, r);
 }
 
 int driver_refresh(void)



More information about the grass-commit mailing list