Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2008-01-31 11:23:08 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2008-01-31 11:23:08 (GMT)
commitb830be70dc7c81f93a5ebd76abcc0a55b65846b4 (patch)
treeb47963ac8167976c7b9d99f2d4713bc91b8e708b
parent2a24c3f16f9ae6a6dc210abbef64c78aba4ddded (diff)
Use the new cairo function cairo_format_stride_for_width when available.
2008-01-31 Carlos Garcia Campos <carlosgc@gnome.org> * configure.ac: * backend/djvu/djvu-document.c: (djvu_document_render): * backend/tiff/tiff-document.c: (tiff_document_render): Use the new cairo function cairo_format_stride_for_width when available. Fixes bug #482720. svn path=/trunk/; revision=2884
-rw-r--r--ChangeLog9
-rw-r--r--backend/djvu/djvu-document.c5
-rw-r--r--backend/tiff/tiff-document.c6
-rw-r--r--configure.ac6
4 files changed, 24 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7cd5683..9869dd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2008-01-31 Carlos Garcia Campos <carlosgc@gnome.org>
+ * configure.ac:
+ * backend/djvu/djvu-document.c: (djvu_document_render):
+ * backend/tiff/tiff-document.c: (tiff_document_render):
+
+ Use the new cairo function cairo_format_stride_for_width when
+ available. Fixes bug #482720.
+
+2008-01-31 Carlos Garcia Campos <carlosgc@gnome.org>
+
* libdocument/ev-document-factory.c: (get_mime_type_from_uri),
(get_mime_type_from_data), (get_document_from_uri):
diff --git a/backend/djvu/djvu-document.c b/backend/djvu/djvu-document.c
index f27d66f..6e1c5f3 100644
--- a/backend/djvu/djvu-document.c
+++ b/backend/djvu/djvu-document.c
@@ -261,8 +261,11 @@ djvu_document_render (EvDocument *document,
default:
rotation = DDJVU_ROTATE_0;
}
-
+#ifdef HAVE_CAIRO_FORMAT_STRIDE_FOR_WIDTH
+ rowstride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, page_width);
+#else
rowstride = page_width * 4;
+#endif
pixels = (gchar *) g_malloc (page_height * rowstride);
surface = cairo_image_surface_create_for_data ((guchar *)pixels,
CAIRO_FORMAT_RGB24,
diff --git a/backend/tiff/tiff-document.c b/backend/tiff/tiff-document.c
index d8bee9e..86170e2 100644
--- a/backend/tiff/tiff-document.c
+++ b/backend/tiff/tiff-document.c
@@ -246,11 +246,15 @@ tiff_document_render (EvDocument *document,
if (width <= 0 || height <= 0)
return NULL;
+#ifdef HAVE_CAIRO_FORMAT_STRIDE_FOR_WIDTH
+ rowstride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width);
+#else
rowstride = width * 4;
if (rowstride / 4 != width)
/* overflow */
return NULL;
-
+#endif
+
bytes = height * rowstride;
if (bytes / rowstride != height)
/* overflow */
diff --git a/configure.ac b/configure.ac
index e2c9065..3ba95e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,12 @@ PKG_CHECK_MODULES(SHELL_CORE, libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_RE
BACKEND_LIBTOOL_FLAGS="-module -avoid-version"
AC_SUBST(BACKEND_LIBTOOL_FLAGS)
+dnl ===== Check special functions
+evince_save_LIBS=$LIBS
+LIBS="$LIBS $BACKEND_LIBS"
+AC_CHECK_FUNCS(cairo_format_stride_for_width)
+LIBS=$evince_save_LIBS
+
AC_ARG_WITH(keyring,
AC_HELP_STRING([--without-keyring],[disable the use of gnome-keyring]),
[case "${withval}" in