Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/libview
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2010-01-04 10:58:31 (GMT)
committer Carlos Garcia Campos <carlosgc@gnome.org>2010-01-04 11:03:22 (GMT)
commit7594280f6850f95297ef88aeb2dac9ca6a6de53f (patch)
tree63ac1d4ed6e56d8af8443961961284e0ebf79642 /libview
parent21e6ac78b4873f8bea2712fe524b3ebadfb55eda (diff)
[presentation] Make sure we always have a valid surface to draw a page
It avoids flickering or even a black screen when changing pages fast. Fixes bug #602738.
Diffstat (limited to 'libview')
-rw-r--r--libview/ev-view-presentation.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c
index 2dfed6a..c516602 100644
--- a/libview/ev-view-presentation.c
+++ b/libview/ev-view-presentation.c
@@ -57,6 +57,7 @@ struct _EvViewPresentation
GtkWidget base;
guint current_page;
+ cairo_surface_t *current_surface;
EvDocument *document;
guint rotation;
EvPresentationState state;
@@ -291,7 +292,9 @@ ev_view_presentation_animation_start (EvViewPresentation *pview,
pview->animation = ev_transition_animation_new (effect);
surface = EV_JOB_RENDER (pview->curr_job)->surface;
- ev_transition_animation_set_origin_surface (pview->animation, surface);
+ ev_transition_animation_set_origin_surface (pview->animation,
+ surface != NULL ?
+ surface : pview->current_surface);
jump = new_page - pview->current_page;
if (jump == -1)
@@ -878,6 +881,19 @@ ev_view_presentation_hide_cursor_timeout_start (EvViewPresentation *pview)
}
static void
+ev_view_presentation_update_current_surface (EvViewPresentation *pview,
+ cairo_surface_t *surface)
+{
+ if (!surface || pview->current_surface == surface)
+ return;
+
+ cairo_surface_reference (surface);
+ if (pview->current_surface)
+ cairo_surface_destroy (pview->current_surface);
+ pview->current_surface = surface;
+}
+
+static void
ev_view_presentation_destroy (GtkObject *object)
{
EvViewPresentation *pview = EV_VIEW_PRESENTATION (object);
@@ -906,6 +922,11 @@ ev_view_presentation_destroy (GtkObject *object)
pview->next_job = NULL;
}
+ if (pview->current_surface) {
+ cairo_surface_destroy (pview->current_surface);
+ pview->current_surface = NULL;
+ }
+
if (pview->page_cache) {
g_object_unref (pview->page_cache);
pview->page_cache = NULL;
@@ -1026,8 +1047,13 @@ ev_view_presentation_expose_event (GtkWidget *widget,
}
surface = pview->curr_job ? EV_JOB_RENDER (pview->curr_job)->surface : NULL;
- if (!surface)
+ if (surface) {
+ ev_view_presentation_update_current_surface (pview, surface);
+ } else if (pview->current_surface) {
+ surface = pview->current_surface;
+ } else {
return FALSE;
+ }
ev_view_presentation_get_page_area (pview, &page_area);
if (gdk_rectangle_intersect (&page_area, &(event->area), &overlap)) {