From 4207c30cf856a79bc6e23219bf43554470cd4b0b Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Sun, 13 Jan 2008 11:23:44 +0000 Subject: [PATCH] Bump requirements to libspectre 0.2.0. Fixes bug #507705. 2008-01-13 Carlos Garcia Campos * 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. svn path=/trunk/; revision=2816 --- ChangeLog | 8 ++++++++ backend/dvi/cairo-device.c | 24 ++++++++++++------------ backend/ps/ev-spectre.c | 4 +++- configure.ac | 5 +++-- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index f0939039..9994b618 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-01-13 Carlos Garcia Campos + + * 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. + 2008-01-04 Carlos Garnacho * shell/ev-transition-animation.c (ev_transition_animation_fade) diff --git a/backend/dvi/cairo-device.c b/backend/dvi/cairo-device.c index 95f3e63a..b8ec39e6 100644 --- a/backend/dvi/cairo-device.c +++ b/backend/dvi/cairo-device.c @@ -135,8 +135,8 @@ dvi_cairo_draw_ps (DviContext *dvi, 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 @@ dvi_cairo_draw_ps (DviContext *dvi, 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; } diff --git a/backend/ps/ev-spectre.c b/backend/ps/ev-spectre.c index 41553df2..1252b8d2 100644 --- a/backend/ps/ev-spectre.c +++ b/backend/ps/ev-spectre.c @@ -289,7 +289,9 @@ ps_document_render (EvDocument *document, 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); diff --git a/configure.ac b/configure.ac index 7c50c967..afd29edc 100644 --- a/configure.ac +++ b/configure.ac @@ -261,9 +261,10 @@ fi 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 @@ if test x$enable_ps = xyes; then 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, -- 2.43.5