diff --git a/page-widget.c b/page-widget.c index 34c903e..d52e14d 100644 --- a/page-widget.c +++ b/page-widget.c @@ -452,7 +452,7 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo) } /* render real page */ - render_page(priv->zathura->sync.render_thread, priv->page, false, NULL); + render_page(priv->zathura->sync.render_thread, priv->page); } g_static_mutex_unlock(&(priv->lock)); return FALSE; diff --git a/print.c b/print.c index 35d5e16..247352b 100644 --- a/print.c +++ b/print.c @@ -93,5 +93,5 @@ cb_print_draw_page(GtkPrintOperation* UNUSED(print_operation), GtkPrintContext* return; } - render_page(zathura->sync.render_thread, page, true, cairo); + zathura_page_render(page, cairo, true); } diff --git a/render.c b/render.c index ed93b6e..a709f64 100644 --- a/render.c +++ b/render.c @@ -22,38 +22,17 @@ struct render_thread_s GThreadPool* pool; /**< Pool of threads */ }; -typedef struct job_s -{ - zathura_page_t* page; - bool printing; - cairo_t* target; - GMutex* mutex; - GCond* cond; -} job_t; - static void render_job(void* data, void* user_data) { - job_t* job = data; + zathura_page_t* page = data; zathura_t* zathura = user_data; - if (job == NULL || zathura == NULL || job->page == NULL) { + if (page == NULL || zathura == NULL) { return; } - if (job->printing == false) { - girara_debug("Rendering page %d", zathura_page_get_index(job->page)); - if (render(zathura, job->page) != true) { - girara_error("Rendering failed (page %d)\n", zathura_page_get_index(job->page)); - } - g_free(data); - } else if (job->target != NULL) { - girara_debug("Rendering page %d for printing", zathura_page_get_index(job->page)); - g_mutex_lock(job->mutex); - if (zathura_page_render(job->page, job->target, true) != ZATHURA_ERROR_OK) { - girara_error("Rendering failed (page %d)\n", zathura_page_get_index(job->page)); - } - g_cond_signal(job->cond); - g_mutex_unlock(job->mutex); + if (render(zathura, page) != true) { + girara_error("Rendering failed (page %d)\n", zathura_page_get_index(page)); } } @@ -93,30 +72,13 @@ render_free(render_thread_t* render_thread) } bool -render_page(render_thread_t* render_thread, zathura_page_t* page, bool printing, cairo_t* target) +render_page(render_thread_t* render_thread, zathura_page_t* page) { if (render_thread == NULL || page == NULL || render_thread->pool == NULL) { return false; } - job_t* job = g_malloc0(sizeof(job_t)); - job->page = page; - job->printing = printing; - job->target = target; - if (printing == true) { - job->mutex = g_mutex_new(); - job->cond = g_cond_new(); - g_mutex_lock(job->mutex); - } - g_thread_pool_push(render_thread->pool, job, NULL); - if (printing == true) { - g_cond_wait(job->cond, job->mutex); - g_mutex_unlock(job->mutex); - g_cond_free(job->cond); - g_mutex_free(job->mutex); - g_free(job); - } - + g_thread_pool_push(render_thread->pool, page, NULL); return true; } diff --git a/render.h b/render.h index 901b6ce..435ef83 100644 --- a/render.h +++ b/render.h @@ -31,11 +31,9 @@ void render_free(render_thread_t* render_thread); * * @param render_thread The render thread object * @param page The page that should be rendered - * @param printing Render the page for printing. - * @param target Rendering target in case we're rendering for printing. * @return true if no error occured */ -bool render_page(render_thread_t* render_thread, zathura_page_t* page, bool printing, cairo_t* target); +bool render_page(render_thread_t* render_thread, zathura_page_t* page); /** * This function is used to unmark all pages as not rendered. This should