[GRASS-CVS] markus: grass6/lib/cairodriver Graph.c, 1.1.2.2, 1.1.2.3

grass at intevation.de grass at intevation.de
Thu Nov 29 05:38:23 EST 2007


Author: markus

Update of /grassrepository/grass6/lib/cairodriver
In directory doto:/tmp/cvs-serv13425

Modified Files:
      Tag: releasebranch_6_3
	Graph.c 
Log Message:
fixed from HEAD

Index: Graph.c
===================================================================
RCS file: /grassrepository/grass6/lib/cairodriver/Graph.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- Graph.c	23 Nov 2007 10:47:12 -0000	1.1.2.2
+++ Graph.c	29 Nov 2007 10:38:21 -0000	1.1.2.3
@@ -21,6 +21,7 @@
 /* globals */
 char *file_name;
 int file_type;
+int is_vector;
 int width, height, stride;
 unsigned char *grid;
 int modified;
@@ -138,12 +139,27 @@
 		G_fatal_error("Unknown file extension: %s", p);
 	G_debug(1, "File type: %s (%d)", file_name, file_type);
 
+	switch (file_type)
+	{
+	case FTYPE_PDF:
+	case FTYPE_PS:
+	case FTYPE_SVG:
+		is_vector = 1;
+		break;
+	}
+
 	p = getenv("GRASS_CAIRO_MAPPED");
 	do_map = p && strcmp(p, "TRUE") == 0 && ends_with(file_name, ".bmp");
 
 	p = getenv("GRASS_CAIRO_READ");
 	do_read = p && strcmp(p, "TRUE") == 0;
 
+	if (is_vector)
+	{
+		do_read = do_map = 0;
+		bgcolor_a = 1.0;
+	}
+
 	if (do_read && access(file_name, 0) != 0)
 		do_read = 0;
 
@@ -153,13 +169,12 @@
 	if (do_read && do_map)
 		map_file();
 
-	if (!mapped)
-	{
+	if (!mapped && !is_vector)
 		grid = G_malloc(height * stride);
-		init_cairo();
-	}
 
-	if (!do_read)
+	init_cairo();
+
+	if (!do_read && !is_vector)
 	{
 		Cairo_Erase();
 		modified = 1;
@@ -172,6 +187,7 @@
 	{
 		write_image();
 		map_file();
+		init_cairo();
 	}
 
 	return 0;
@@ -307,7 +323,6 @@
 		G_free(grid);
 	}
 	grid = (char *) ptr + HEADER_SIZE;
-	init_cairo();
 
 	close(fd);
 




More information about the grass-commit mailing list