]> www.fi.muni.cz Git - evince.git/commitdiff
[libdocument] Use EvPage instead of EvRenderContext in get_selected_text()
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 8 May 2010 10:24:36 +0000 (12:24 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 8 May 2010 10:24:36 +0000 (12:24 +0200)
It doesn't depend on scale and rotation so we only need the page.

backend/djvu/djvu-document.c
backend/pdf/ev-poppler.cc
libdocument/ev-selection.c
libdocument/ev-selection.h
libview/ev-view.c

index 8a747de0c9af4148fec5f4771d72114671fdd7c7..0023a1c2678d397c8cabb70426e82bb64ce8e419 100644 (file)
@@ -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 ("");
index ac1fce8627047d857bda7b000d095ea616c25063..add48f7448ab85d6a75b28e1d55b11e87a1fd166 100644 (file)
@@ -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;
index 260a9ca46906c2b03370a0c6e27468a281d72698..25879a9202ffc63e14054d04a807c9b8d7c46cc6 100644 (file)
@@ -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 *
index 65e0c155f02bae897cfb6541e2f7acaa34cca179..19b61bb5e1ed31c8ca0ec75692a21b23137373c7 100644 (file)
@@ -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,
index 3a91508281780acc1e543270b1567b125c579683..ac8b9498c73e0f9c30fd59170136998262e992aa 100644 (file)
@@ -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);