[evince] [libdocument] Use EvPage instead of EvRenderContext in get_selected_text()
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] [libdocument] Use EvPage instead of EvRenderContext in get_selected_text()
- Date: Sat, 8 May 2010 10:25:49 +0000 (UTC)
commit eb80ecd1f7aa6ff57d2a3324c691274745ca4ed0
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Sat May 8 12:24:36 2010 +0200
[libdocument] Use EvPage instead of EvRenderContext in get_selected_text()
It doesn't depend on scale and rotation so we only need the page.
backend/djvu/djvu-document.c | 6 +++---
backend/pdf/ev-poppler.cc | 4 ++--
libdocument/ev-selection.c | 4 ++--
libdocument/ev-selection.h | 4 ++--
libview/ev-view.c | 11 ++---------
5 files changed, 11 insertions(+), 18 deletions(-)
---
diff --git a/backend/djvu/djvu-document.c b/backend/djvu/djvu-document.c
index 8a747de..0023a1c 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 ac1fce8..add48f7 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 260a9ca..25879a9 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 65e0c15..19b61bb 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 3a91508..ac8b949 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]