diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2008-01-19 17:19:42 (GMT) |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@src.gnome.org> | 2008-01-19 17:19:42 (GMT) |
commit | 8e126907002877574ec86fcbd184e56dc8f74683 (patch) | |
tree | e64bd193d556c898aa94a60ae18d98a5fa3ddc5d /shell/ev-window.c | |
parent | 1e6e971293804f30b9e06c0131b4445a5ce17445 (diff) |
Do not render images when rendering the page but on demand. It reduces the
2008-01-19 Carlos Garcia Campos <carlosgc@gnome.org>
* configure.ac:
* backend/pdf/ev-poppler.cc:
(pdf_document_images_get_image_mapping),
(pdf_document_images_get_image),
(pdf_document_document_images_iface_init):
* libdocument/ev-document-images.[ch]:
(ev_document_images_get_image_mapping),
(ev_document_images_get_image):
* libdocument/ev-image.[ch]: (ev_image_new), (ev_image_get_page),
(ev_image_get_id), (ev_image_save_tmp):
* shell/ev-jobs.c: (ev_job_render_run):
* shell/ev-view.c: (ev_view_drag_data_get):
* shell/ev-window.c: (image_save_dialog_response_cb),
(ev_view_popup_cmd_copy_image):
Do not render images when rendering the page but on demand. It
reduces the memory comsumption.
svn path=/trunk/; revision=2835
Diffstat (limited to 'shell/ev-window.c')
-rw-r--r-- | shell/ev-window.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c index ab8eb1d..4b4fee3 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -46,6 +46,7 @@ #include "ev-document-links.h" #include "ev-document-fonts.h" #include "ev-document-find.h" +#include "ev-document-images.h" #include "ev-document-security.h" #include "ev-document-factory.h" #include "ev-job-queue.h" @@ -4978,17 +4979,17 @@ image_save_dialog_response_cb (GtkWidget *fc, gint response_id, EvWindow *ev_window) { - GnomeVFSURI *target_uri; - gboolean is_local; - GError *error = NULL; - - gchar *uri; - gchar *uri_extension; - gchar **extensions; - gchar *filename; - gchar *file_format; - GdkPixbufFormat* format; - GtkFileFilter *filter; + GnomeVFSURI *target_uri; + gboolean is_local; + GError *error = NULL; + GdkPixbuf *pixbuf; + gchar *uri; + gchar *uri_extension; + gchar **extensions; + gchar *filename; + gchar *file_format; + GdkPixbufFormat *format; + GtkFileFilter *filter; if (response_id != GTK_RESPONSE_OK) { gtk_widget_destroy (fc); @@ -5029,9 +5030,14 @@ image_save_dialog_response_cb (GtkWidget *fc, g_free (uri); g_free (uri_extension); + + ev_document_doc_mutex_lock (); + pixbuf = ev_document_images_get_image (EV_DOCUMENT_IMAGES (ev_window->priv->document), + ev_window->priv->image); + ev_document_doc_mutex_unlock (); - gdk_pixbuf_save (ev_image_get_pixbuf (ev_window->priv->image), - filename, file_format, &error, NULL); + gdk_pixbuf_save (pixbuf, filename, file_format, &error, NULL); + g_object_unref (pixbuf); if (error) { ev_window_error_message (GTK_WINDOW (ev_window), @@ -5094,14 +5100,20 @@ static void ev_view_popup_cmd_copy_image (GtkAction *action, EvWindow *window) { GtkClipboard *clipboard; + GdkPixbuf *pixbuf; if (!window->priv->image) return; clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD); - gtk_clipboard_set_image (clipboard, - ev_image_get_pixbuf (window->priv->image)); + ev_document_doc_mutex_lock (); + pixbuf = ev_document_images_get_image (EV_DOCUMENT_IMAGES (window->priv->document), + window->priv->image); + ev_document_doc_mutex_unlock (); + + gtk_clipboard_set_image (clipboard, pixbuf); + g_object_unref (pixbuf); } static void |