Commit eb80ecd1 authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

[libdocument] Use EvPage instead of EvRenderContext in get_selected_text()

It doesn't depend on scale and rotation so we only need the page.
parent d92e0160
......@@ -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 ("");
......
......@@ -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;
......
......@@ -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 *
......
......@@ -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,
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment