kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16.git/commit/?id=4b319d794bebe6afc7f65c5f20341d2cf116d7f5

commit 4b319d794bebe6afc7f65c5f20341d2cf116d7f5
Author: Kim Woelders <[email protected]>
Date:   Sun Jan 25 00:05:10 2015 +0100

    Wrap some calls to XRenderCreatePicture().
---
 src/ecompmgr.c | 15 ++-------------
 src/eimage.c   |  9 ++-------
 src/x.c        | 14 ++++++++++++++
 src/xwin.h     |  3 ++-
 4 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/src/ecompmgr.c b/src/ecompmgr.c
index fec31e8..10d70f7 100644
--- a/src/ecompmgr.c
+++ b/src/ecompmgr.c
@@ -1152,8 +1152,6 @@ ECompMgrWinSetPicts(EObj * eo)
 
    if (cw->picture == NoXID)
      {
-       XRenderPictFormat  *pictfmt;
-       XRenderPictureAttributes pa;
        EX_Drawable         draw = EobjGetXwin(eo);
 
        if ((cw->pixmap && Mode_compmgr.use_pixmap) || (cw->fadeout))
@@ -1161,10 +1159,7 @@ ECompMgrWinSetPicts(EObj * eo)
        if (draw == NoXID)
           return;
 
-       pictfmt = XRenderFindVisualFormat(disp, WinGetVisual(EobjGetWin(eo)));
-       pa.subwindow_mode = IncludeInferiors;
-       cw->picture = XRenderCreatePicture(disp, draw,
-                                          pictfmt, CPSubwindowMode, &pa);
+       cw->picture = EPictureCreateII(EobjGetWin(eo), draw);
        D1printf("%s: %#x: Pict=%#x (drawable=%#x)\n", __func__,
                 EobjGetXwin(eo), cw->picture, draw);
 
@@ -2148,8 +2143,6 @@ ECompMgrStart(void)
 {
    EObj               *const *lst;
    int                 i, num;
-   XRenderPictFormat  *pictfmt;
-   XRenderPictureAttributes pa;
 
    if (Mode_compmgr.active || Conf_compmgr.mode == ECM_MODE_OFF)
       return;
@@ -2187,11 +2180,7 @@ ECompMgrStart(void)
 
    ECompMgrRootBufferCreate(WinGetW(VROOT), WinGetH(VROOT));
 
-   pa.subwindow_mode = IncludeInferiors;
-   pictfmt = XRenderFindVisualFormat(disp, WinGetVisual(VROOT));
-   rootPicture =
-      XRenderCreatePicture(disp, Mode_compmgr.root, pictfmt, CPSubwindowMode,
-                          &pa);
+   rootPicture = EPictureCreateII(VROOT, Mode_compmgr.root);
 
    Mode_compmgr.rgn_tmp = ERegionCreate();
    Mode_compmgr.rgn_tmp2 = ERegionCreate();
diff --git a/src/eimage.c b/src/eimage.c
index 6827674..0203dc1 100644
--- a/src/eimage.c
+++ b/src/eimage.c
@@ -496,8 +496,6 @@ ScaleRect(Win wsrc, EX_Drawable src, Win wdst, EX_Pixmap 
dst,
 #if USE_XRENDER
    if (Conf.testing.use_render_for_scaling)
      {
-       XRenderPictFormat  *pictfmt;
-       XRenderPictureAttributes pa;
        XTransform          tr;
        EX_Picture          psrc, pdst;
        double              scale_x, scale_y;
@@ -509,11 +507,8 @@ ScaleRect(Win wsrc, EX_Drawable src, Win wdst, EX_Pixmap 
dst,
        tr.matrix[1][1] = XDoubleToFixed(scale_y);
        tr.matrix[2][2] = XDoubleToFixed(1.);
 
-       pa.subwindow_mode = IncludeInferiors;
-       pictfmt = XRenderFindVisualFormat(disp, wsrc->visual);
-       psrc = XRenderCreatePicture(disp, src, pictfmt, CPSubwindowMode, &pa);
-       pictfmt = XRenderFindVisualFormat(disp, wdst->visual);
-       pdst = XRenderCreatePicture(disp, dst, pictfmt, CPSubwindowMode, &pa);
+       psrc = EPictureCreateII(wsrc, src);
+       pdst = EPictureCreateII(wdst, dst);
 
        XRenderSetPictureFilter(disp, psrc, (flags & EIMAGE_ANTI_ALIAS) ?
                                FilterBest : FilterNearest, NULL, 0);
diff --git a/src/x.c b/src/x.c
index a29e533..9e80bad 100644
--- a/src/x.c
+++ b/src/x.c
@@ -2078,6 +2078,20 @@ EPictureCreate(Win win, EX_Drawable draw)
 }
 
 EX_Picture
+EPictureCreateII(Win win, EX_Drawable draw)
+{
+   EX_Picture          pict;
+   XRenderPictFormat  *pictfmt;
+   XRenderPictureAttributes pa;
+
+   pictfmt = XRenderFindVisualFormat(disp, WinGetVisual(win));
+   pa.subwindow_mode = IncludeInferiors;
+   pict = XRenderCreatePicture(disp, draw, pictfmt, CPSubwindowMode, &pa);
+
+   return pict;
+}
+
+EX_Picture
 EPictureCreateSolid(EX_Window xwin, int argb, unsigned int a, unsigned int rgb)
 {
    Display            *dpy = disp;
diff --git a/src/xwin.h b/src/xwin.h
index d7334f5..5d60acb 100644
--- a/src/xwin.h
+++ b/src/xwin.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various 
contributors
- * Copyright (C) 2004-2014 Kim Woelders
+ * Copyright (C) 2004-2015 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -307,6 +307,7 @@ void                PmapMaskFree(PmapMask * pmm);
 
 #if USE_XRENDER
 EX_Picture          EPictureCreate(Win win, EX_Drawable draw);
+EX_Picture          EPictureCreateII(Win win, EX_Drawable draw);
 EX_Picture          EPictureCreateSolid(EX_Window xwin, int argb,
                                        unsigned int a, unsigned int rgb);
 EX_Picture          EPictureCreateBuffer(Win win, int w, int h, int argb,

-- 


Reply via email to