From b830be70dc7c81f93a5ebd76abcc0a55b65846b4 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Thu, 31 Jan 2008 11:23:08 +0000 Subject: Use the new cairo function cairo_format_stride_for_width when available. 2008-01-31 Carlos Garcia Campos * 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 --- (limited to 'backend') 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 */ -- cgit v0.9.1