X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=backend%2Fdjvu%2Fdjvu-document.c;h=776d0dc861d602b495c5ee9612ee5368084d265d;hb=b329a61d561198cd405721372580d05476c2240a;hp=e26db4a693530fe3f952bd721812afd656bbf8d9;hpb=766adb9bff7a5c8ada0d18cafd3643e647fb6f23;p=evince.git diff --git a/backend/djvu/djvu-document.c b/backend/djvu/djvu-document.c index e26db4a6..776d0dc8 100644 --- a/backend/djvu/djvu-document.c +++ b/backend/djvu/djvu-document.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" @@ -323,7 +323,6 @@ djvu_document_render (EvDocument *document, ddjvu_page_t *d_page; ddjvu_page_rotation_t rotation; double page_width, page_height, tmp; - static const cairo_user_data_key_t key; d_page = ddjvu_page_create_by_pageno (djvu_document->d_document, rc->page->index); @@ -355,19 +354,12 @@ 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, - page_width, - page_height, - rowstride); - cairo_surface_set_user_data (surface, &key, - pixels, (cairo_destroy_func_t)g_free); + + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, + page_width, page_height); + rowstride = cairo_image_surface_get_stride (surface); + pixels = (gchar *)cairo_image_surface_get_data (surface); + prect.x = 0; prect.y = 0; prect.w = page_width; @@ -383,6 +375,8 @@ djvu_document_render (EvDocument *document, rowstride, pixels); + cairo_surface_mark_dirty (surface); + return surface; }