X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=backend%2Fdjvu%2Fdjvu-document.c;h=7ab5c76cc00f35b40439f7360f6bba3d07c2e361;hb=d3688d90ef2ac74632997a421a042e44534af9d9;hp=88c7b0c074114d8b1fd0d5f2028fe6189dce1020;hpb=e63cb09538113fa2695bc2877902702109eed303;p=evince.git diff --git a/backend/djvu/djvu-document.c b/backend/djvu/djvu-document.c index 88c7b0c0..7ab5c76c 100644 --- a/backend/djvu/djvu-document.c +++ b/backend/djvu/djvu-document.c @@ -170,7 +170,7 @@ djvu_document_load (EvDocument *document, g_set_error_literal (error, EV_DOCUMENT_ERROR, EV_DOCUMENT_ERROR_INVALID, - _("DJVU document has incorrect format")); + _("DjVu document has incorrect format")); return FALSE; } @@ -248,7 +248,7 @@ djvu_document_load (EvDocument *document, G_FILE_ERROR, G_FILE_ERROR_EXIST, _("The document is composed of several files. " - "One or more of such files cannot be accessed.")); + "One or more of these files cannot be accessed.")); return FALSE; } @@ -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; }