GtkWidget base;
guint current_page;
+ cairo_surface_t *current_surface;
EvDocument *document;
guint rotation;
EvPresentationState state;
duration = ev_document_transition_get_page_duration (EV_DOCUMENT_TRANSITION (pview->document),
pview->current_page);
- if (duration > 0) {
+ if (duration >= 0) {
pview->trans_timeout_id =
g_timeout_add_seconds (duration,
(GSourceFunc) transition_next_page,
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)
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)
{
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;
cairo_translate (cr, page_area.x, page_area.y);
page_area.x = page_area.y = 0;
+ /* Try to fix rounding errors */
+ page_area.width--;
+
ev_transition_animation_paint (pview->animation, cr, page_area);
cairo_destroy (cr);
}
}
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)) {
cr = gdk_cairo_create (widget->window);
- cairo_translate (cr, overlap.x, overlap.y);
- cairo_surface_set_device_offset (surface,
- overlap.x - page_area.x,
- overlap.y - page_area.y);
- cairo_set_source_surface (cr, surface, 0, 0);
- cairo_paint (cr);
+ /* Try to fix rounding errors. See bug #438760 */
+ if (overlap.width == page_area.width)
+ overlap.width--;
+
+ cairo_rectangle (cr, overlap.x, overlap.y, overlap.width, overlap.height);
+ cairo_set_source_surface (cr, surface, page_area.x, page_area.y);
+ cairo_fill (cr);
cairo_destroy (cr);
}
ev_view_presentation_set_white (pview);
return TRUE;
+ case GDK_Home:
+ if (pview->state == EV_PRESENTATION_NORMAL) {
+ ev_view_presentation_update_current_page (pview, 0);
+ return TRUE;
+ }
+ break;
+ case GDK_End:
+ if (pview->state == EV_PRESENTATION_NORMAL) {
+ gint page;
+
+ page = ev_document_get_n_pages (pview->document) - 1;
+ ev_view_presentation_update_current_page (pview, page);
+
+ return TRUE;
+ }
+ break;
default:
break;
}