evince r2816 - in trunk: . backend/dvi backend/ps



Author: carlosgc
Date: Sun Jan 13 11:23:44 2008
New Revision: 2816
URL: http://svn.gnome.org/viewvc/evince?rev=2816&view=rev

Log:
2008-01-13  Carlos Garcia Campos  <carlosgc gnome org>
	* configure.ac:
	* backend/dvi/cairo-device.c: (dvi_cairo_draw_ps):
	* backend/ps/ev-spectre.c: (ps_document_render):
	Bump requirements to libspectre 0.2.0. Fixes bug #507705.


Modified:
   trunk/ChangeLog
   trunk/backend/dvi/cairo-device.c
   trunk/backend/ps/ev-spectre.c
   trunk/configure.ac

Modified: trunk/backend/dvi/cairo-device.c
==============================================================================
--- trunk/backend/dvi/cairo-device.c	(original)
+++ trunk/backend/dvi/cairo-device.c	Sun Jan 13 11:23:44 2008
@@ -135,8 +135,8 @@
 	unsigned char        *data = NULL;
 	int                   row_length;
 	SpectreDocument      *psdoc;
-	SpectrePage          *page;
 	SpectreRenderContext *rc;
+	int                   w, h;
 	SpectreStatus         status;
 	cairo_surface_t      *image;
 
@@ -148,24 +148,24 @@
 		spectre_document_free (psdoc);
 		return;
 	}
-	
-	page = spectre_document_get_page (psdoc, 0);
-	if (!page) {
-		spectre_document_free (psdoc);
-		return;
-	}
+
+	spectre_document_get_page_size (psdoc, &w, &h);
 
 	rc = spectre_render_context_new ();
-	spectre_render_context_set_page_size (rc, width, height);
-	spectre_page_render (page, rc, &data, &row_length);
-	status = spectre_page_status (page);
-	spectre_render_context_free (rc);
+	spectre_render_context_set_scale (rc,
+					  (double)width / w,
+					  (double)height / h);
+	spectre_document_render_full (psdoc, rc, &data, &row_length);	
+	status = spectre_document_status (psdoc);
 
-	spectre_page_free (page);
+	spectre_render_context_free (rc);
 	spectre_document_free (psdoc);
 
 	if (status) {
+		g_warning ("Error rendering PS document %s: %s\n",
+			   filename, spectre_status_to_string (status));
 		free (data);
+		
 		return;
 	}
 

Modified: trunk/backend/ps/ev-spectre.c
==============================================================================
--- trunk/backend/ps/ev-spectre.c	(original)
+++ trunk/backend/ps/ev-spectre.c	Sun Jan 13 11:23:44 2008
@@ -289,7 +289,9 @@
 	rotation = (rc->rotation + get_page_rotation (ps_page)) % 360;
 
 	src = spectre_render_context_new ();
-	spectre_render_context_set_page_size (src, width, height);
+	spectre_render_context_set_scale (src,
+					  (gdouble)width / width_points,
+					  (gdouble)height / height_points);
 	spectre_render_context_set_rotation (src, rotation);
 	spectre_page_render (ps_page, src, &data, &stride);
 	spectre_render_context_free (src);

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Sun Jan 13 11:23:44 2008
@@ -261,9 +261,10 @@
 
 AM_CONDITIONAL(ENABLE_PDF, test x$enable_pdf = xyes)
 dnl ================== end of pdf checks ============================================
+SPECTRE_REQUIRED=0.2.0
 
 dnl libspectre (used by ps and dvi backends)
-PKG_CHECK_MODULES(SPECTRE, libspectre,have_spectre=yes,have_spectre=no)
+PKG_CHECK_MODULES(SPECTRE, libspectre >= $SPECTRE_REQUIRED,have_spectre=yes,have_spectre=no)
 AM_CONDITIONAL(HAVE_SPECTRE, test x$have_spectre = xyes)
 if test "x$have_spectre" = "xyes"; then
    AC_DEFINE([HAVE_SPECTRE], [1], [Have libpectre])
@@ -285,7 +286,7 @@
       GS_VERSION=`gs --version | head -n 1 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
       AC_MSG_RESULT(found $GS_VERSION)
       if test "$GS_VERSION" -lt "7"; then
-      	 AC_MSG_WARN([PS support is disabled since libspectre or Ghostscript (version >= 7) are needed])
+      	 AC_MSG_WARN([PS support is disabled since libspectre (version >= $SPECTRE_REQUIRED) or Ghostscript (version >= 7) are needed])
 	 enable_ps=no
       else
          AC_ARG_WITH(gs-aa-params,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]