X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-jobs.c;h=d9cdac8ae33c20e751c184e4c199d8d936ce2a9d;hb=c8e5475fea2b7a92f935e4ae69994fdaf95da2bd;hp=9fb242a0c6cd5a35dd2559f7e48c366a3c7afc08;hpb=ca679febd93eef2a4a6afd99cbd7aee8ab537443;p=evince.git diff --git a/shell/ev-jobs.c b/shell/ev-jobs.c index 9fb242a0..d9cdac8a 100644 --- a/shell/ev-jobs.c +++ b/shell/ev-jobs.c @@ -4,6 +4,7 @@ #include "ev-document-links.h" #include "ev-document-images.h" #include "ev-document-factory.h" +#include "ev-document-misc.h" #include "ev-file-helpers.h" #include "ev-document-fonts.h" #include "ev-selection.h" @@ -120,9 +121,9 @@ ev_job_render_dispose (GObject *object) job = EV_JOB_RENDER (object); - if (job->pixbuf) { - g_object_unref (job->pixbuf); - job->pixbuf = NULL; + if (job->surface) { + cairo_surface_destroy (job->surface); + job->surface = NULL; } if (job->rc) { @@ -131,7 +132,7 @@ ev_job_render_dispose (GObject *object) } if (job->selection) { - g_object_unref (job->selection); + cairo_surface_destroy (job->selection); job->selection = NULL; } @@ -167,6 +168,11 @@ ev_job_thumbnail_dispose (GObject *object) job->thumbnail = NULL; } + if (job->rc) { + g_object_unref (job->rc); + job->rc = NULL; + } + (* G_OBJECT_CLASS (ev_job_thumbnail_parent_class)->dispose) (object); } @@ -294,13 +300,16 @@ ev_job_render_new (EvDocument *document, } static void -render_finished_cb (EvDocument *document, GdkPixbuf *pixbuf, EvJobRender *job) +render_finished_cb (EvDocument *document, + GdkPixbuf *pixbuf, + EvJobRender *job) { g_signal_handlers_disconnect_by_func (EV_JOB (job)->document, render_finished_cb, job); + /* FIXME: ps backend should be ported to cairo */ + job->surface = ev_document_misc_surface_from_pixbuf (pixbuf); EV_JOB (job)->finished = TRUE; - job->pixbuf = g_object_ref (pixbuf); ev_job_finished (EV_JOB (job)); } @@ -320,7 +329,7 @@ ev_job_render_run (EvJobRender *job) } else { ev_document_fc_mutex_lock (); - job->pixbuf = ev_document_render_pixbuf (EV_JOB (job)->document, job->rc); + job->surface = ev_document_render (EV_JOB (job)->document, job->rc); if (job->include_links && EV_IS_DOCUMENT_LINKS (EV_JOB (job)->document)) job->link_mapping = ev_document_links_get_links (EV_DOCUMENT_LINKS (EV_JOB (job)->document), @@ -354,19 +363,15 @@ ev_job_render_run (EvJobRender *job) } EvJob * -ev_job_thumbnail_new (EvDocument *document, - gint page, - int rotation, - gint requested_width) +ev_job_thumbnail_new (EvDocument *document, + EvRenderContext *rc) { EvJobThumbnail *job; job = g_object_new (EV_TYPE_JOB_THUMBNAIL, NULL); EV_JOB (job)->document = g_object_ref (document); - job->page = page; - job->rotation = rotation; - job->requested_width = requested_width; + job->rc = g_object_ref (rc); return EV_JOB (job); } @@ -380,10 +385,7 @@ ev_job_thumbnail_run (EvJobThumbnail *job) job->thumbnail = ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (EV_JOB (job)->document), - job->page, - job->rotation, - job->requested_width, - TRUE); + job->rc, TRUE); EV_JOB (job)->finished = TRUE; ev_document_doc_mutex_unlock ();