From: Carlos Garcia Campos Date: Sat, 8 May 2010 10:24:36 +0000 (+0200) Subject: [libdocument] Use EvPage instead of EvRenderContext in get_selected_text() X-Git-Tag: EVINCE_2_31_2~62 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=eb80ecd1f7aa6ff57d2a3324c691274745ca4ed0;p=evince.git [libdocument] Use EvPage instead of EvRenderContext in get_selected_text() It doesn't depend on scale and rotation so we only need the page. --- diff --git a/backend/djvu/djvu-document.c b/backend/djvu/djvu-document.c index 8a747de0..0023a1c2 100644 --- a/backend/djvu/djvu-document.c +++ b/backend/djvu/djvu-document.c @@ -443,7 +443,7 @@ djvu_text_copy (DjvuDocument *djvu_document, static gchar * djvu_selection_get_selected_text (EvSelection *selection, - EvRenderContext *rc, + EvPage *page, EvSelectionStyle style, EvRectangle *points) { @@ -453,13 +453,13 @@ djvu_selection_get_selected_text (EvSelection *selection, gchar *text; djvu_document_get_page_size (EV_DOCUMENT (djvu_document), - rc->page, &width, &height); + page, &width, &height); rectangle.x1 = points->x1 / SCALE_FACTOR; rectangle.y1 = (height - points->y2) / SCALE_FACTOR; rectangle.x2 = points->x2 / SCALE_FACTOR; rectangle.y2 = (height - points->y1) / SCALE_FACTOR; - text = djvu_text_copy (djvu_document, rc->page->index, &rectangle); + text = djvu_text_copy (djvu_document, page->index, &rectangle); if (text == NULL) text = g_strdup (""); diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc index ac1fce86..add48f74 100644 --- a/backend/pdf/ev-poppler.cc +++ b/backend/pdf/ev-poppler.cc @@ -1960,7 +1960,7 @@ pdf_selection_render_selection (EvSelection *selection, static gchar * pdf_selection_get_selected_text (EvSelection *selection, - EvRenderContext *rc, + EvPage *page, EvSelectionStyle style, EvRectangle *points) { @@ -1969,7 +1969,7 @@ pdf_selection_get_selected_text (EvSelection *selection, double height; char *retval; - poppler_page = POPPLER_PAGE (rc->page->backend_page); + poppler_page = POPPLER_PAGE (page->backend_page); poppler_page_get_size (poppler_page, NULL, &height); r.x1 = points->x1; diff --git a/libdocument/ev-selection.c b/libdocument/ev-selection.c index 260a9ca4..25879a92 100644 --- a/libdocument/ev-selection.c +++ b/libdocument/ev-selection.c @@ -53,13 +53,13 @@ ev_selection_render_selection (EvSelection *selection, gchar * ev_selection_get_selected_text (EvSelection *selection, - EvRenderContext *rc, + EvPage *page, EvSelectionStyle style, EvRectangle *points) { EvSelectionInterface *iface = EV_SELECTION_GET_IFACE (selection); - return iface->get_selected_text (selection, rc, style, points); + return iface->get_selected_text (selection, page, style, points); } GdkRegion * diff --git a/libdocument/ev-selection.h b/libdocument/ev-selection.h index 65e0c155..19b61bb5 100644 --- a/libdocument/ev-selection.h +++ b/libdocument/ev-selection.h @@ -61,7 +61,7 @@ struct _EvSelectionInterface GdkColor *text, GdkColor *base); gchar * (* get_selected_text) (EvSelection *selection, - EvRenderContext *rc, + EvPage *page, EvSelectionStyle style, EvRectangle *points); GdkRegion * (* get_selection_map) (EvSelection *selection, @@ -82,7 +82,7 @@ void ev_selection_render_selection (EvSelection *selection, GdkColor *text, GdkColor *base); gchar *ev_selection_get_selected_text (EvSelection *selection, - EvRenderContext *rc, + EvPage *page, EvSelectionStyle style, EvRectangle *points); GdkRegion *ev_selection_get_selection_map (EvSelection *selection, diff --git a/libview/ev-view.c b/libview/ev-view.c index 3a915082..ac8b9498 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -5523,10 +5523,8 @@ get_selected_text (EvView *view) GString *text; GList *l; gchar *normalized_text; - EvRenderContext *rc; text = g_string_new (NULL); - rc = ev_render_context_new (NULL, view->rotation, view->scale); ev_document_doc_mutex_lock (); @@ -5536,19 +5534,14 @@ get_selected_text (EvView *view) gchar *tmp; page = ev_document_get_page (view->document, selection->page); - ev_render_context_set_page (rc, page); - g_object_unref (page); - tmp = ev_selection_get_selected_text (EV_SELECTION (view->document), - rc, selection->style, + page, selection->style, &(selection->rect)); - + g_object_unref (page); g_string_append (text, tmp); g_free (tmp); } - g_object_unref (rc); - ev_document_doc_mutex_unlock (); normalized_text = g_utf8_normalize (text->str, text->len, G_NORMALIZE_NFKC);