Commit 7ad6c2f4 authored by Sebastian Ramacher's avatar Sebastian Ramacher Committed by Sebastian Ramacher
Browse files

Don't render same page multiple times



If we have already requested a page to be rendered, we don't have to request it
once again.

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 35adeacb
......@@ -22,6 +22,7 @@ typedef struct zathura_page_widget_private_s {
zathura_page_t* page; /**< Page object */
zathura_t* zathura; /**< Zathura object */
cairo_surface_t* surface; /**< Cairo surface */
bool render_requested; /**< No surface and rendering has been requested */
gint64 last_view; /**< Last time the page has been viewed */
mutex lock; /**< Lock */
......@@ -140,9 +141,10 @@ static void
zathura_page_widget_init(ZathuraPage* widget)
{
zathura_page_widget_private_t* priv = ZATHURA_PAGE_GET_PRIVATE(widget);
priv->page = NULL;
priv->surface = NULL;
priv->last_view = g_get_real_time();
priv->page = NULL;
priv->surface = NULL;
priv->render_requested = false;
priv->last_view = g_get_real_time();
priv->links.list = NULL;
priv->links.retrieved = false;
......@@ -467,7 +469,10 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
}
/* render real page */
render_page(priv->zathura->sync.render_thread, priv->page);
if (priv->render_requested == false) {
priv->render_requested = true;
render_page(priv->zathura->sync.render_thread, priv->page);
}
}
mutex_unlock(&(priv->lock));
return FALSE;
......@@ -489,6 +494,7 @@ zathura_page_widget_update_surface(ZathuraPage* widget, cairo_surface_t* surface
cairo_surface_finish(priv->surface);
cairo_surface_destroy(priv->surface);
}
priv->render_requested = false;
priv->surface = surface;
mutex_unlock(&(priv->lock));
/* force a redraw here */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment