[Xfce4-commits] <xfwm4:master> If making a solid fill, use XRenderCreateSolidFill

Alistair Buxton noreply at xfce.org
Sat Dec 7 12:28:02 CET 2013


Updating branch refs/heads/master
         to 4c9dd03362b974f4e2bfd0de77d00cce91ad29eb (commit)
       from 6f0327f21bb6a9f000e59ab8c70a111a02da5269 (commit)

commit 4c9dd03362b974f4e2bfd0de77d00cce91ad29eb
Author: Alistair Buxton <a.j.buxton at gmail.com>
Date:   Sun Dec 1 01:23:26 2013 +0000

    If making a solid fill, use XRenderCreateSolidFill
    
    This avoids the need for an intermediate pixmap, which simplifies the code.
    Note the removal of XFreePixmap. This shouldn't have ben done on a pixmap
    taken from atoms, which is now the only type of pixmap we deal with in this
    function.

 src/compositor.c |   26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 40212d6..94e8045 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -809,11 +809,10 @@ root_tile (ScreenInfo *screen_info)
     DisplayInfo *display_info;
     Display *dpy;
     Picture picture;
+#ifdef MONITOR_ROOT_PIXMAP
     Pixmap pixmap;
-    gboolean fill = FALSE;
     XRenderPictureAttributes pa;
     XRenderPictFormat *format;
-#ifdef MONITOR_ROOT_PIXMAP
     gint p;
     Atom backgroundProps[2];
 #endif
@@ -823,7 +822,6 @@ root_tile (ScreenInfo *screen_info)
 
     display_info = screen_info->display_info;
     dpy = display_info->dpy;
-    pixmap = None;
 #ifdef MONITOR_ROOT_PIXMAP
     backgroundProps[0] = display_info->atoms[XROOTPMAP];
     backgroundProps[1] = display_info->atoms[XSETROOT];
@@ -848,24 +846,15 @@ root_tile (ScreenInfo *screen_info)
         {
             memcpy (&pixmap, prop, 4);
             XFree (prop);
-            fill = FALSE;
+            pa.repeat = TRUE;
+            format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen_info->screen));
+            g_return_val_if_fail (format != NULL, None);
+            picture = XRenderCreatePicture (dpy, pixmap, format, CPRepeat, &pa);
             break;
         }
     }
 #endif
-    if (!pixmap)
-    {
-        pixmap = XCreatePixmap (dpy, screen_info->output, 1, 1,
-                                DefaultDepth (dpy, screen_info->screen));
-        g_return_val_if_fail (pixmap != None, None);
-        fill = TRUE;
-    }
-    pa.repeat = TRUE;
-    format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen_info->screen));
-    g_return_val_if_fail (format != NULL, None);
-
-    picture = XRenderCreatePicture (dpy, pixmap, format, CPRepeat, &pa);
-    if ((picture != None) && (fill))
+    if (picture == None)
     {
         XRenderColor c;
 
@@ -874,9 +863,8 @@ root_tile (ScreenInfo *screen_info)
         c.green = 0x7f00;
         c.blue  = 0x7f00;
         c.alpha = 0xffff;
-        XRenderFillRectangle (dpy, PictOpSrc, picture, &c, 0, 0, 1, 1);
+        picture = XRenderCreateSolidFill (dpy, &c);
     }
-    XFreePixmap (dpy, pixmap);
     return picture;
 }
 


More information about the Xfce4-commits mailing list