]> git.eshelyaron.com Git - emacs.git/commitdiff
Draw offscreen surface
authorPo Lu <luangruo@yahoo.com>
Thu, 4 Nov 2021 10:53:55 +0000 (18:53 +0800)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 7 Nov 2021 01:59:40 +0000 (02:59 +0100)
* src/xwidget.c (xv_do_draw): Draw offscreen surface.

src/xwidget.c

index ff7d09549bf98d9a831899c3c40051e5270cea88..c7589871584d5eea511f4771f42a90acbf375101 100644 (file)
@@ -520,12 +520,20 @@ xwidget_hide_view (struct xwidget_view *xv)
 static void
 xv_do_draw (struct xwidget_view *xw, struct xwidget *w)
 {
+  GtkOffscreenWindow *wnd;
+  cairo_surface_t *surface;
   block_input ();
+  wnd = GTK_OFFSCREEN_WINDOW (w->widgetwindow_osr);
+  surface = gtk_offscreen_window_get_surface (wnd);
 
   cairo_save (xw->cr_context);
-  cairo_translate (xw->cr_context, -xw->clip_left,
-                  -xw->clip_top);
-  gtk_widget_draw (w->widgetwindow_osr, xw->cr_context);
+  if (surface)
+    {
+      cairo_set_source_surface (xw->cr_context, surface, xw->clip_left,
+                               xw->clip_top);
+      cairo_set_operator (xw->cr_context, CAIRO_OPERATOR_SOURCE);
+      cairo_paint (xw->cr_context);
+    }
   cairo_restore (xw->cr_context);
 
   unblock_input ();