mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-01 08:46:00 +01:00
Merge branch 'develop' of pwmt.org:zathura into develop
This commit is contained in:
commit
dbe0a5c84b
5 changed files with 48 additions and 0 deletions
1
AUTHORS
1
AUTHORS
|
@ -8,6 +8,7 @@ Other contributors are (in alphabetical order):
|
||||||
Aepelzen <abietz@gmx.de>
|
Aepelzen <abietz@gmx.de>
|
||||||
Pavel Borzenkov <pavel.borzenkov@gmail.com>
|
Pavel Borzenkov <pavel.borzenkov@gmail.com>
|
||||||
Géraud Le Falher <daureg@gmail.com>
|
Géraud Le Falher <daureg@gmail.com>
|
||||||
|
Glen Winters <lamouche@gmail.com>
|
||||||
Ivan Sichmann Freitas <ivansichfreitas@gmail.com>
|
Ivan Sichmann Freitas <ivansichfreitas@gmail.com>
|
||||||
Felix Herrmann <felix@herrmann-koenigsberg.de>
|
Felix Herrmann <felix@herrmann-koenigsberg.de>
|
||||||
int3 <jezreel@gmail.com>
|
int3 <jezreel@gmail.com>
|
||||||
|
|
2
marks.c
2
marks.c
|
@ -243,6 +243,8 @@ mark_evaluate(zathura_t* zathura, int key)
|
||||||
position_set_delayed(zathura, mark->position_x, mark->position_y);
|
position_set_delayed(zathura, mark->position_x, mark->position_y);
|
||||||
|
|
||||||
cb_view_vadjustment_value_changed(NULL, zathura);
|
cb_view_vadjustment_value_changed(NULL, zathura);
|
||||||
|
|
||||||
|
zathura->global.update_page_number = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GIRARA_LIST_FOREACH_END(zathura->global.marks, zathura_mark_t*, iter, mark);
|
GIRARA_LIST_FOREACH_END(zathura->global.marks, zathura_mark_t*, iter, mark);
|
||||||
|
|
3
print.c
3
print.c
|
@ -28,6 +28,7 @@ print(zathura_t* zathura)
|
||||||
gtk_print_operation_set_allow_async(print_operation, TRUE);
|
gtk_print_operation_set_allow_async(print_operation, TRUE);
|
||||||
gtk_print_operation_set_n_pages(print_operation, zathura_document_get_number_of_pages(zathura->document));
|
gtk_print_operation_set_n_pages(print_operation, zathura_document_get_number_of_pages(zathura->document));
|
||||||
gtk_print_operation_set_current_page(print_operation, zathura_document_get_current_page_number(zathura->document));
|
gtk_print_operation_set_current_page(print_operation, zathura_document_get_current_page_number(zathura->document));
|
||||||
|
gtk_print_operation_set_use_full_page(print_operation, TRUE);
|
||||||
|
|
||||||
/* print operation signals */
|
/* print operation signals */
|
||||||
g_signal_connect(print_operation, "draw-page", G_CALLBACK(cb_print_draw_page), zathura);
|
g_signal_connect(print_operation, "draw-page", G_CALLBACK(cb_print_draw_page), zathura);
|
||||||
|
@ -93,5 +94,7 @@ cb_print_draw_page(GtkPrintOperation* UNUSED(print_operation), GtkPrintContext*
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
render_lock(zathura->sync.render_thread);
|
||||||
zathura_page_render(page, cairo, true);
|
zathura_page_render(page, cairo, true);
|
||||||
|
render_unlock(zathura->sync.render_thread);
|
||||||
}
|
}
|
||||||
|
|
27
render.c
27
render.c
|
@ -20,6 +20,7 @@ static gint render_thread_sort(gconstpointer a, gconstpointer b, gpointer data);
|
||||||
struct render_thread_s
|
struct render_thread_s
|
||||||
{
|
{
|
||||||
GThreadPool* pool; /**< Pool of threads */
|
GThreadPool* pool; /**< Pool of threads */
|
||||||
|
GStaticMutex mutex; /**< Render lock */
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -31,6 +32,7 @@ render_job(void* data, void* user_data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
girara_debug("rendring page %d ...", zathura_page_get_index(page));
|
||||||
if (render(zathura, page) != true) {
|
if (render(zathura, page) != true) {
|
||||||
girara_error("Rendering failed (page %d)\n", zathura_page_get_index(page));
|
girara_error("Rendering failed (page %d)\n", zathura_page_get_index(page));
|
||||||
}
|
}
|
||||||
|
@ -48,6 +50,7 @@ render_init(zathura_t* zathura)
|
||||||
}
|
}
|
||||||
|
|
||||||
g_thread_pool_set_sort_function(render_thread->pool, render_thread_sort, zathura);
|
g_thread_pool_set_sort_function(render_thread->pool, render_thread_sort, zathura);
|
||||||
|
g_static_mutex_init(&render_thread->mutex);
|
||||||
|
|
||||||
return render_thread;
|
return render_thread;
|
||||||
|
|
||||||
|
@ -68,6 +71,7 @@ render_free(render_thread_t* render_thread)
|
||||||
g_thread_pool_free(render_thread->pool, TRUE, TRUE);
|
g_thread_pool_free(render_thread->pool, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_static_mutex_free(&render_thread->mutex);
|
||||||
g_free(render_thread);
|
g_free(render_thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,12 +123,15 @@ render(zathura_t* zathura, zathura_page_t* page)
|
||||||
cairo_scale(cairo, scale, scale);
|
cairo_scale(cairo, scale, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
render_lock(zathura->sync.render_thread);
|
||||||
if (zathura_page_render(page, cairo, false) != ZATHURA_ERROR_OK) {
|
if (zathura_page_render(page, cairo, false) != ZATHURA_ERROR_OK) {
|
||||||
|
render_unlock(zathura->sync.render_thread);
|
||||||
cairo_destroy(cairo);
|
cairo_destroy(cairo);
|
||||||
cairo_surface_destroy(surface);
|
cairo_surface_destroy(surface);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
render_unlock(zathura->sync.render_thread);
|
||||||
cairo_restore(cairo);
|
cairo_restore(cairo);
|
||||||
cairo_destroy(cairo);
|
cairo_destroy(cairo);
|
||||||
|
|
||||||
|
@ -221,3 +228,23 @@ render_thread_sort(gconstpointer a, gconstpointer b, gpointer data)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
render_lock(render_thread_t* render_thread)
|
||||||
|
{
|
||||||
|
if (render_thread == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_static_mutex_lock(&render_thread->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
render_unlock(render_thread_t* render_thread)
|
||||||
|
{
|
||||||
|
if (render_thread == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_static_mutex_unlock(&render_thread->mutex);
|
||||||
|
}
|
||||||
|
|
15
render.h
15
render.h
|
@ -44,4 +44,19 @@ bool render_page(render_thread_t* render_thread, zathura_page_t* page);
|
||||||
*/
|
*/
|
||||||
void render_all(zathura_t* zathura);
|
void render_all(zathura_t* zathura);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lock the render thread. This is useful if you want to render on your own (e.g
|
||||||
|
* for printing).
|
||||||
|
*
|
||||||
|
* @param render_thread The render thread object.
|
||||||
|
*/
|
||||||
|
void render_lock(render_thread_t* render_thread);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unlock the render thread.
|
||||||
|
*
|
||||||
|
* @param render_thread The render thread object.
|
||||||
|
*/
|
||||||
|
void render_unlock(render_thread_t* render_thread);
|
||||||
|
|
||||||
#endif // RENDER_H
|
#endif // RENDER_H
|
||||||
|
|
Loading…
Reference in a new issue