+
+ cairo_surface_set_device_offset (page_surface,
+ overlap.x - real_page_area.x,
+ overlap.y - real_page_area.y);
+
+ cairo_set_source_surface (cr, page_surface, 0, 0);
+ cairo_paint (cr);
+
+ cairo_restore (cr);
+
+ /* Get the selection pixbuf iff we have something to draw */
+ if (find_selection_for_page (view, page) &&
+ view->selection_mode == EV_VIEW_SELECTION_TEXT) {
+ selection_surface =
+ ev_pixbuf_cache_get_selection_surface (view->pixbuf_cache,
+ page,
+ view->scale,
+ NULL);
+ }
+
+ if (!selection_surface) {
+ cairo_destroy (cr);
+ return;
+ }
+
+ selection_width = cairo_image_surface_get_width (selection_surface);
+ selection_height = cairo_image_surface_get_height (selection_surface);
+
+ cairo_rectangle (cr, overlap.x, overlap.y, overlap.width, overlap.height);
+ cairo_clip (cr);
+
+ cairo_translate (cr, overlap.x, overlap.y);
+
+ if (width != selection_width || height != selection_height) {
+ cairo_pattern_set_filter (cairo_get_source (cr),
+ CAIRO_FILTER_FAST);
+ cairo_scale (cr,
+ (gdouble)width / selection_width,
+ (gdouble)height / selection_height);
+ }
+
+ cairo_surface_set_device_offset (selection_surface,
+ overlap.x - real_page_area.x,
+ overlap.y - real_page_area.y);
+
+ cairo_set_source_surface (cr, selection_surface, 0, 0);
+ cairo_paint (cr);
+ cairo_destroy (cr);