[Xfce4-commits] [xfce/xfwm4] 01/03: compositor: Do not repaint if region is empty

noreply at xfce.org noreply at xfce.org
Tue Jul 17 11:46:40 CEST 2018


This is an automated email from the git hooks/post-receive script.

o   l   i   v   i   e   r       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfwm4.

commit 62ba8614249c894ee37dc0377e8f3f6a51adcfd0
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Sun May 27 17:05:59 2018 +0200

    compositor: Do not repaint if region is empty
    
    Just a small attempt at optimizing things a bit.
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 src/compositor.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index fe5529f..3bf8e93 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1955,6 +1955,19 @@ paint_win (CWindow *cw, XserverRegion region, Picture paint_buffer, gboolean sol
     }
 }
 
+static gboolean
+is_region_empty (Display *dpy, XserverRegion region)
+{
+  XRectangle bounds;
+  XRectangle *rects;
+  int nrects;
+
+  rects = XFixesFetchRegionAndBounds (dpy, region, &nrects, &bounds);
+  XFree (rects);
+
+  return (nrects == 0 || bounds.width == 0 || bounds.height == 0);
+}
+
 static void
 paint_all (ScreenInfo *screen_info, XserverRegion region, gushort buffer)
 {
@@ -2071,7 +2084,10 @@ paint_all (ScreenInfo *screen_info, XserverRegion region, gushort buffer)
      * reapply clipping for the last iteration.
      */
     XFixesSetPictureClipRegion (dpy, paint_buffer, 0, 0, paint_region);
-    paint_root (screen_info, paint_buffer);
+    if (!is_region_empty (dpy, paint_region))
+    {
+        paint_root (screen_info, paint_buffer);
+    }
 
     /*
      * Painting from bottom to top, translucent windows and shadows are painted now...
@@ -2141,7 +2157,6 @@ paint_all (ScreenInfo *screen_info, XserverRegion region, gushort buffer)
         }
         /* Set clipping back to the given region */
         XFixesSetPictureClipRegion (dpy, screen_info->rootBuffer[buffer], 0, 0, region);
-
     }
     else
 #endif /* HAVE_EPOXY */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list