Browse Source

Replace D_cell_draw_setup() with D_cell_draw_begin()

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@33092 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 16 years ago
parent
commit
cac4f78b4a
6 changed files with 11 additions and 27 deletions
  1. 2 3
      display/d.his/main.c
  2. 2 5
      display/d.profile/main.c
  3. 3 4
      display/d.rast/display.c
  4. 2 3
      display/d.rgb/main.c
  5. 1 1
      include/display.h
  6. 1 11
      lib/display/raster.c

+ 2 - 3
display/d.his/main.c

@@ -54,7 +54,6 @@ int main(int argc, char **argv)
     struct GModule *module;
     struct Option *opt_h, *opt_i, *opt_s, *brighten;
     struct Flag *nulldraw;
-    double t, b, l, r;
     double bright_mult;
 
 
@@ -117,9 +116,7 @@ int main(int argc, char **argv)
 
     /* Prepare the raster cell drawing functions */
     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);
 
     /* Get name of layer to be used for hue */
     name_h = opt_h->answer;
@@ -202,6 +199,8 @@ int main(int argc, char **argv)
     intensity = 255;		/* default is to not change intensity */
     saturation = 255;		/* default is to not change saturation */
 
+    D_cell_draw_begin();
+
     next_row = 0;
     for (atrow = 0; atrow < window.rows;) {
 	G_percent(atrow, window.rows, 2);

+ 2 - 5
display/d.profile/main.c

@@ -426,16 +426,12 @@ int main(int argc, char **argv)
 
 void myDcell(char *name, char *mapset, int overlay)
 {
-    int fd, i, t, b, l, r, code;
+    int fd, i, code;
     CELL *cell;
     struct Colors clr;
 
     D_setup(!overlay);
-
-    D_get_screen_window(&t, &b, &l, &r);
-
     D_set_overlay_mode(overlay);
-    D_cell_draw_setup(t, b, l, r);
 
     cell = G_allocate_c_raster_buf();
 
@@ -447,6 +443,7 @@ void myDcell(char *name, char *mapset, int overlay)
 	G_fatal_error(_("%s: Couldn't read color table for <%s@%s>"),
 		      G_program_name(), name, mapset);
 
+    D_cell_draw_begin();
     for (i = 0; i >= 0;) {
 	code = G_get_c_raster_row(fd, cell, i);
 	if (code < 0)

+ 3 - 4
display/d.rast/display.c

@@ -51,17 +51,14 @@ static int cell_draw(char *name,
     int cellfile;
     void *xarray;
     int cur_A_row;
-    double t, b, l, r;
     int ncols, nrows;
 
     ncols = G_window_cols();
     nrows = G_window_rows();
 
     /* Set up the screen, conversions, and graphics */
-    D_get_dst(&t, &b, &l, &r);
+    D_setup(0);
     D_set_overlay_mode(overlay);
-    if (D_cell_draw_setup(t, b, l, r))
-	G_fatal_error(_("Cannot use current window"));
 
     /* Make sure map is available */
     if ((cellfile = G_open_cell_old(name, mapset)) == -1)
@@ -70,6 +67,8 @@ static int cell_draw(char *name,
     /* Allocate space for cell buffer */
     xarray = G_allocate_raster_buf(data_type);
 
+    D_cell_draw_begin();
+
     /* loop for array rows */
     for (cur_A_row = 0; cur_A_row != -1;) {
 	G_percent(cur_A_row, nrows, 2);

+ 2 - 3
display/d.rgb/main.c

@@ -45,7 +45,6 @@ int main(int argc, char **argv)
     struct Cell_head window;
     struct GModule *module;
     struct Flag *flag_o;
-    double t, b, l, r;
     int i;
 
     G_gisinit(argv[0]);
@@ -84,9 +83,7 @@ int main(int argc, char **argv)
 	G_fatal_error(_("No graphics device selected"));
 
     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);
 
     for (i = 0; i < 3; i++) {
 	/* Get name of layer to be used */
@@ -112,6 +109,8 @@ int main(int argc, char **argv)
     /* read in current window */
     G_get_window(&window);
 
+    D_cell_draw_begin();
+
     next_row = 0;
     for (row = 0; row < window.rows;) {
 	G_percent(row, window.rows, 5);

+ 1 - 1
include/display.h

@@ -124,7 +124,7 @@ int D_draw_d_raster(int, const DCELL *, struct Colors *);
 int D_draw_f_raster(int, const FCELL *, struct Colors *);
 int D_draw_c_raster(int, const CELL *, struct Colors *);
 int D_draw_cell(int, const CELL *, struct Colors *);
-int D_cell_draw_setup(double, double, double, double);
+void D_cell_draw_begin(void);
 int D_draw_raster_RGB(int, const void *, const void *, const void *,
 		      struct Colors *, struct Colors *, struct Colors *,
 		      RASTER_MAP_TYPE, RASTER_MAP_TYPE, RASTER_MAP_TYPE);

+ 1 - 11
lib/display/raster.c

@@ -130,22 +130,12 @@ static int draw_cell(int A_row,
  *  \return int
  */
 
-int D_cell_draw_setup(double t, double b, double l, double r)
+void D_cell_draw_begin(void)
 {
-    struct Cell_head window;
-
-    if (G_get_set_window(&window) == -1)
-	G_fatal_error("Current window not available");
-
-    D_do_conversions(&window, t, b, l, r);
-
     /* Set up the screen for drawing map */
     D_get_a(src);
     D_get_d(dst);
-
     R_begin_scaled_raster(D__overlay_mode, src, dst);
-
-    return 0;
 }
 
 int D_draw_raster_RGB(int A_row,