Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        hiwin.c x.c 


Log Message:
No need to fetch shape rects in EWindowGetShapePixmap().

===================================================================
RCS file: /cvs/e/e16/e/src/hiwin.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- hiwin.c     5 Jun 2008 08:55:20 -0000       1.33
+++ hiwin.c     5 Jun 2008 09:20:25 -0000       1.34
@@ -59,12 +59,8 @@
 {
    EImage             *im;
    Pixmap              mask;
-   int                 shaped;
 
-   mask = None;
-   shaped = EShapeCheck(EobjGetWin(eo));
-   if (shaped)
-      mask = EWindowGetShapePixmap(EobjGetWin(eo));
+   mask = EWindowGetShapePixmap(EobjGetWin(eo));
    im = EImageGrabDrawable(draw, mask, 0, 0, EobjGetW(eo), EobjGetH(eo), 0);
    if (mask)
       EFreePixmap(mask);
===================================================================
RCS file: /cvs/e/e16/e/src/x.c,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -3 -r1.176 -r1.177
--- x.c 5 Jun 2008 08:55:21 -0000       1.176
+++ x.c 5 Jun 2008 09:20:25 -0000       1.177
@@ -1548,6 +1548,35 @@
    return win->num_rect != 0;
 }
 
+/* Build mask from window shape rects */
+Pixmap
+EWindowGetShapePixmap(Win win)
+{
+   Pixmap              mask;
+   GC                  gc;
+   int                 i;
+   const XRectangle   *rect;
+
+   if (win->num_rect == 0)     /* Not shaped */
+      return None;
+
+   mask = ECreatePixmap(win, win->w, win->h, 1);
+   gc = EXCreateGC(mask, 0, NULL);
+
+   XSetForeground(disp, gc, 0);
+   XFillRectangle(disp, mask, gc, 0, 0, win->w, win->h);
+
+   XSetForeground(disp, gc, 1);
+   rect = win->rects;
+   for (i = 0; i < win->num_rect; i++)
+      XFillRectangle(disp, mask, gc, rect[i].x, rect[i].y,
+                    rect[i].width, rect[i].height);
+
+   EXFreeGC(gc);
+
+   return mask;
+}
+
 Pixmap
 ECreatePixmap(Win win, unsigned int width, unsigned int height,
              unsigned int depth)
@@ -1667,40 +1696,6 @@
    pxc->green = pec->green << 8;
    pxc->blue = pec->blue << 8;
    XAllocColor(disp, cmap, pxc);
-}
-
-/* Build mask from window shape rects */
-/* Snatched from imlib_create_scaled_image_from_drawable() */
-Pixmap
-EWindowGetShapePixmap(Win win)
-{
-   Pixmap              mask;
-   GC                  gc;
-   XRectangle         *rect;
-   int                 i, w, h;
-   int                 rect_num, rect_ord;
-
-   EGetGeometry(win, NULL, NULL, NULL, &w, &h, NULL, NULL);
-   mask = ECreatePixmap(win, w, h, 1);
-
-   gc = EXCreateGC(mask, 0, NULL);
-   XSetForeground(disp, gc, 0);
-
-   rect =
-      XShapeGetRectangles(disp, win->xwin, ShapeBounding, &rect_num, 
&rect_ord);
-   XFillRectangle(disp, mask, gc, 0, 0, w, h);
-   if (rect)
-     {
-       XSetForeground(disp, gc, 1);
-       for (i = 0; i < rect_num; i++)
-          XFillRectangle(disp, mask, gc, rect[i].x, rect[i].y,
-                         rect[i].width, rect[i].height);
-       XFree(rect);
-     }
-
-   EXFreeGC(gc);
-
-   return mask;
 }
 
 /*



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to