Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h draw.c pager.c 


Log Message:
Use imlib2 for pager updates.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.381
retrieving revision 1.382
diff -u -3 -r1.381 -r1.382
--- E.h 2 Mar 2005 20:09:44 -0000       1.381
+++ E.h 2 Mar 2005 23:23:43 -0000       1.382
@@ -1483,11 +1483,6 @@
 void                HandleDrawQueue(void);
 char                IsPropagateEwinOnQueue(EWin * ewin);
 
-void                ScaleLine(Pixmap dest, Window src, int dx, int dy, int sw,
-                             int pw, int sy, int sh);
-void                ScaleRect(Pixmap dest, Window src, int sx, int sy, int dx,
-                             int dy, int sw, int sh, int dw, int dh);
-
 Imlib_Image        *ELoadImage(const char *file);
 void                DrawEwinShape(EWin * ewin, int md, int x, int y, int w,
                                  int h, char firstlast);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/draw.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- draw.c      2 Mar 2005 20:09:45 -0000       1.57
+++ draw.c      2 Mar 2005 23:23:55 -0000       1.58
@@ -24,9 +24,6 @@
 #include <sys/ipc.h>
 #include <sys/shm.h>
 
-/* Hmmm... */
-#define HIQ Conf.pagers.hiq
-
 void
 HandleDrawQueue()
 {
@@ -876,429 +873,6 @@
 /* XCopyArea(disp, dst->pmap, VRoot.win, dst->gc, x, y, w, h, x, y); */
 }
 
-void
-ScaleLine(Pixmap dest, Window src, int dx, int dy, int sw, int pw, int sy,
-         int sh)
-{
-   static GC           gc = 0;
-   XGCValues           gcv;
-   int                 x, x2;
-   PixImg             *p_grab = NULL, *p_grab2 = NULL, *p_buf = NULL;
-   XImage             *px_grab = NULL, *px_grab2 = NULL, *px_buf = NULL;
-
-   if (!gc)
-     {
-       gcv.subwindow_mode = IncludeInferiors;
-       gc = ECreateGC(src, GCSubwindowMode, &gcv);
-     }
-
-   p_grab = ECreatePixImg(dest, sw, 1);
-   if (p_grab)
-     {
-       p_buf = ECreatePixImg(dest, pw, 1);
-       if (p_buf)
-         {
-            XCopyArea(disp, src, p_grab->pmap, gc, 0, sy, sw, 1, 0, 0);
-            if (HIQ)
-              {
-                 p_grab2 = ECreatePixImg(dest, sw, 1);
-                 if (!p_grab2)
-                    goto boo1;
-
-                 XCopyArea(disp, src, p_grab2->pmap, gc, 0,
-                           sy + (sh / 2), sw, 1, 0, 0);
-              }
-            ecore_x_sync();
-            goto wheee;
-
-          boo1:
-            EDestroyPixImg(p_buf);
-            p_buf = NULL;
-         }
-       EDestroyPixImg(p_grab);
-       p_grab = NULL;
-     }
-
-   px_grab = XGetImage(disp, src, 0, sy, sw, 1, 0xffffffff, ZPixmap);
-   if (px_grab)
-     {
-       px_buf = XCreateImage(disp, VRoot.vis, VRoot.depth, ZPixmap, 0,
-                             NULL, pw, 1, 32, 0);
-       if (px_buf)
-         {
-            px_buf->data = malloc(px_buf->bytes_per_line * px_buf->height);
-            if (!px_buf->data)
-               goto boo2;
-
-            if (HIQ)
-              {
-                 px_grab2 = XGetImage(disp, src, 0, sy + (sh / 2), sw, 1,
-                                      0xffffffff, ZPixmap);
-                 if (!px_grab2)
-                    goto boo2;
-              }
-            goto wheee;
-
-          boo2:
-            XDestroyImage(px_buf);
-         }
-       XDestroyImage(px_grab);
-       return;
-     }
-
- wheee:
-   if (HIQ)
-     {
-       int                 v1, v2, v3, v4, difx;
-       XImage             *xim1 = NULL, *xim2 = NULL, *xim3 = NULL;
-
-       if (p_grab)
-         {
-            xim1 = p_grab->xim;
-            xim2 = p_grab2->xim;
-            xim3 = p_buf->xim;
-         }
-       else
-         {
-            xim1 = px_grab;
-            xim2 = px_grab2;
-            xim3 = px_buf;
-         }
-
-       difx = (sw / pw) / 2;
-       switch (DefaultDepth(disp, VRoot.scr))
-         {
-         case 24:
-         case 32:
-            for (x = 0; x < pw; x++)
-              {
-                 x2 = (sw * x) / pw;
-                 v1 = XGetPixel(xim1, x2, 0);
-                 v2 = XGetPixel(xim1, x2 + difx, 0);
-                 v3 = XGetPixel(xim2, x2, 0);
-                 v4 = XGetPixel(xim2, x2 + difx, 0);
-                 v1 = ((v1 >> 2) & 0x3f3f3f3f) + ((v2 >> 2) & 0x3f3f3f3f) +
-                    ((v3 >> 2) & 0x3f3f3f3f) + ((v4 >> 2) & 0x3f3f3f3f) +
-                    (v1 & v2 & v3 & v4 & 0x03030303);
-                 XPutPixel(xim3, x, 0, v1);
-              }
-            break;
-         case 16:
-            for (x = 0; x < pw; x++)
-              {
-                 x2 = (sw * x) / pw;
-                 v1 = XGetPixel(xim1, x2, 0);
-                 v2 = XGetPixel(xim1, x2 + difx, 0);
-                 v3 = XGetPixel(xim2, x2, 0);
-                 v4 = XGetPixel(xim2, x2 + difx, 0);
-                 v1 = ((v1 >> 2) & ((0x70 << 7) | (0x78 << 2) | (0x70 >> 4)))
-                    +
-                    ((v2 >> 2) & ((0x70 << 7) | (0x78 << 2) | (0x70 >> 4)))
-                    +
-                    ((v3 >> 2) & ((0x70 << 7) | (0x78 << 2) | (0x70 >> 4)))
-                    +
-                    ((v4 >> 2) & ((0x70 << 7) | (0x78 << 2) | (0x70 >> 4)))
-                    + (v1 & v2 & v3 & v4 & ((0x3 << 11) | (0x3 << 5) | (0x3)));
-                 XPutPixel(xim3, x, 0, v1);
-              }
-            break;
-         case 15:
-            /*        break; */
-         default:
-            for (x = 0; x < pw; x++)
-              {
-                 x2 = (sw * x) / pw;
-                 XPutPixel(xim3, x, 0, XGetPixel(xim1, x2, 0));
-              }
-            break;
-         }
-     }
-   else
-     {
-       XImage             *xim1 = NULL, *xim3 = NULL;
-
-       if (p_grab)
-         {
-            xim1 = p_grab->xim;
-            xim3 = p_buf->xim;
-         }
-       else
-         {
-            xim1 = px_grab;
-            xim3 = px_buf;
-         }
-
-       for (x = 0; x < pw; x++)
-         {
-            x2 = (sw * x) / pw;
-            XPutPixel(xim3, x, 0, XGetPixel(xim1, x2, 0));
-         }
-     }
-
-   if (p_buf)
-     {
-       XShmPutImage(disp, dest, gc, p_buf->xim, 0, 0, dx, dy, pw, 1, False);
-       ecore_x_sync();
-       if (p_grab)
-          EDestroyPixImg(p_grab);
-       if (p_grab2)
-          EDestroyPixImg(p_grab2);
-       if (p_buf)
-          EDestroyPixImg(p_buf);
-     }
-   else
-     {
-       XPutImage(disp, dest, gc, px_buf, 0, 0, dx, dy, pw, 1);
-       if (px_grab)
-          XDestroyImage(px_grab);
-       if (px_grab2)
-          XDestroyImage(px_grab2);
-       if (px_buf)
-          XDestroyImage(px_buf);
-     }
-}
-
-void
-ScaleRect(Pixmap dest, Window src, int sx, int sy, int dx, int dy, int sw,
-         int sh, int dw, int dh)
-{
-   static GC           gc = 0, gc2 = 0;
-   XGCValues           gcv;
-   int                 y, y2, x, x2;
-   PixImg             *p_grab = NULL, *p_buf = NULL;
-   XImage             *px_grab = NULL, *px_buf = NULL;
-
-   if (sw > VRoot.w * 2)
-      return;
-   if (sh > VRoot.h * 2)
-      return;
-   if (dw > VRoot.w * 2)
-      return;
-   if (dh > VRoot.h * 2)
-      return;
-
-   if (!gc)
-     {
-       gcv.subwindow_mode = IncludeInferiors;
-       gc = ECreateGC(src, GCSubwindowMode, &gcv);
-       gc2 = ECreateGC(src, 0, &gcv);
-     }
-
-   if (HIQ)
-      p_grab = ECreatePixImg(src, sw, dh * 2);
-   else
-      p_grab = ECreatePixImg(src, sw, dh);
-
-   if (p_grab)
-     {
-       p_buf = ECreatePixImg(dest, dw, dh);
-       if (p_buf)
-         {
-            if (HIQ)
-              {
-                 for (y = 0; y < (dh * 2); y++)
-                   {
-                      y2 = (sh * y) / (dh * 2);
-                      XCopyArea(disp, src, p_grab->pmap, gc, sx, sy + y2, sw,
-                                1, 0, y);
-                   }
-              }
-            else
-              {
-                 for (y = 0; y < dh; y++)
-                   {
-                      y2 = (sh * y) / dh;
-                      XCopyArea(disp, src, p_grab->pmap, gc, sx, sy + y2, sw,
-                                1, 0, y);
-                   }
-              }
-            ecore_x_sync();
-         }
-       else
-         {
-            EDestroyPixImg(p_grab);
-            p_grab = NULL;
-         }
-     }
-
-   if (!p_grab)
-     {
-       if (HIQ)
-         {
-            Pixmap              pmap;
-
-            pmap = ECreatePixmap(src, sw, dh * 2, VRoot.depth);
-            for (y = 0; y < (dh * 2); y++)
-              {
-                 y2 = (sh * y) / (dh * 2);
-                 XCopyArea(disp, src, pmap, gc, sx, sy + y2, sw, 1, 0, y);
-              }
-
-            px_grab =
-               XGetImage(disp, pmap, 0, 0, sw, dh * 2, 0xffffffff, ZPixmap);
-            EFreePixmap(pmap);
-            if (!px_grab)
-               return;
-         }
-       else
-         {
-            Pixmap              pmap;
-
-            pmap = ECreatePixmap(src, sw, dh, VRoot.depth);
-            for (y = 0; y < dh; y++)
-              {
-                 y2 = (sh * y) / dh;
-                 XCopyArea(disp, src, pmap, gc, sx, sy + y2, sw, 1, 0, y);
-              }
-
-            px_grab = XGetImage(disp, pmap, 0, 0, sw, dh, 0xffffffff, ZPixmap);
-            EFreePixmap(pmap);
-            if (!px_grab)
-               return;
-         }
-
-       px_buf =
-          XCreateImage(disp, VRoot.vis, VRoot.depth, ZPixmap, 0, NULL, dw, dh,
-                       32, 0);
-       if (!px_buf)
-         {
-            XDestroyImage(px_grab);
-            return;
-         }
-
-       px_buf->data = malloc(px_buf->bytes_per_line * px_buf->height);
-       if (!px_buf->data)
-         {
-            XDestroyImage(px_buf);
-            XDestroyImage(px_grab);
-            return;
-         }
-     }
-
-   if (HIQ)
-     {
-       int                 v1, v2, v3, v4, difx;
-       XImage             *xim1 = NULL, *xim3 = NULL;
-
-       if (p_grab)
-         {
-            xim1 = p_grab->xim;
-            xim3 = p_buf->xim;
-         }
-       else
-         {
-            xim1 = px_grab;
-            xim3 = px_buf;
-         }
-
-       difx = (sw / dw) / 2;
-       switch (VRoot.depth)
-         {
-         case 24:
-         case 32:
-            for (y = 0; y < dh; y++)
-              {
-                 for (x = 0; x < dw; x++)
-                   {
-                      y2 = (y * 2);
-                      x2 = (sw * x) / dw;
-                      v1 = XGetPixel(xim1, x2, y2);
-                      v2 = XGetPixel(xim1, x2 + difx, y2);
-                      v3 = XGetPixel(xim1, x2, y2 + 1);
-                      v4 = XGetPixel(xim1, x2 + difx, y2 + 1);
-                      v1 = ((v1 >> 2) & 0x3f3f3f3f) +
-                         ((v2 >> 2) & 0x3f3f3f3f) +
-                         ((v3 >> 2) & 0x3f3f3f3f) +
-                         ((v4 >> 2) & 0x3f3f3f3f) +
-                         (v1 & v2 & v3 & v4 & 0x03030303);
-                      XPutPixel(xim3, x, y, v1);
-                   }
-              }
-            break;
-         case 16:
-            for (y = 0; y < dh; y++)
-              {
-                 for (x = 0; x < dw; x++)
-                   {
-                      y2 = (y * 2);
-                      x2 = (sw * x) / dw;
-                      v1 = XGetPixel(xim1, x2, y2);
-                      v2 = XGetPixel(xim1, x2 + difx, y2);
-                      v3 = XGetPixel(xim1, x2, y2 + 1);
-                      v4 = XGetPixel(xim1, x2 + difx, y2 + 1);
-                      v1 = ((v1 >> 2) &
-                            ((0x70 << 7) | (0x78 << 2) | (0x70 >> 4))) +
-                         ((v2 >> 2) &
-                          ((0x70 << 7) | (0x78 << 2) | (0x70 >> 4))) +
-                         ((v3 >> 2) &
-                          ((0x70 << 7) | (0x78 << 2) | (0x70 >> 4))) +
-                         ((v4 >> 2) &
-                          ((0x70 << 7) | (0x78 << 2) | (0x70 >> 4))) +
-                         (v1 & v2 & v3 & v4 &
-                          ((0x3 << 11) | (0x3 << 5) | (0x3)));
-                      XPutPixel(xim3, x, y, v1);
-                   }
-              }
-            break;
-         case 15:
-            /*        break; */
-         default:
-            for (y = 0; y < dh; y++)
-              {
-                 for (x = 0; x < dw; x++)
-                   {
-                      y2 = (y * 2);
-                      x2 = (sw * x) / dw;
-                      XPutPixel(xim3, x, y, XGetPixel(xim1, x2, y2));
-                   }
-              }
-            break;
-         }
-     }
-   else
-     {
-       XImage             *xim1 = NULL, *xim3 = NULL;
-
-       if (p_grab)
-         {
-            xim1 = p_grab->xim;
-            xim3 = p_buf->xim;
-         }
-       else
-         {
-            xim1 = px_grab;
-            xim3 = px_buf;
-         }
-
-       for (y = 0; y < dh; y++)
-         {
-            for (x = 0; x < dw; x++)
-              {
-                 x2 = (sw * x) / dw;
-                 XPutPixel(xim3, x, y, XGetPixel(xim1, x2, y));
-              }
-         }
-     }
-
-   if (p_buf)
-     {
-       XShmPutImage(disp, dest, gc2, p_buf->xim, 0, 0, dx, dy, dw, dh, False);
-       ecore_x_sync();
-       if (p_grab)
-          EDestroyPixImg(p_grab);
-       if (p_buf)
-          EDestroyPixImg(p_buf);
-     }
-   else
-     {
-       XPutImage(disp, dest, gc, px_buf, 0, 0, dx, dy, dw, dh);
-       if (px_grab)
-          XDestroyImage(px_grab);
-       if (px_buf)
-          XDestroyImage(px_buf);
-     }
-}
-
 #include <X11/bitmaps/flipped_gray>
 #include <X11/bitmaps/gray>
 #include <X11/bitmaps/gray3>
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -3 -r1.118 -r1.119
--- pager.c     27 Feb 2005 13:17:30 -0000      1.118
+++ pager.c     2 Mar 2005 23:23:55 -0000       1.119
@@ -127,6 +127,35 @@
 }
 
 static void
+ScaleRect(Window src, Pixmap dst, Pixmap * pdst, int sx, int sy, int sw, int 
sh,
+         int dx, int dy, int dw, int dh, int scale)
+{
+   Imlib_Image        *im;
+   Pixmap              pmap, mask;
+   GC                  gc;
+
+   scale = (scale) ? 2 : 1;
+
+   imlib_context_set_drawable(src);
+   im = imlib_create_scaled_image_from_drawable(None, sx, sy, sw, sh,
+                                               scale * dw, scale * dh, 1, 0);
+   imlib_context_set_image(im);
+   imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, dw, dh);
+   if (pdst)
+     {
+       *pdst = pmap;
+     }
+   else
+     {
+       gc = ECreateGC(dst, 0, NULL);
+       XCopyArea(disp, pmap, dst, gc, 0, 0, dw, dh, dx, dy);
+       EFreeGC(gc);
+       imlib_free_pixmap_and_mask(pmap);
+     }
+   imlib_free_image();
+}
+
+static void
 PagerUpdateTimeout(int val __UNUSED__, void *data)
 {
    Pager              *p;
@@ -171,14 +200,27 @@
    xx = cx * ww;
    yy = cy * hh;
    phase = p->update_phase;
+#if 0
+   /* Due to a bug in imlib2 <= 1.2.0 we have to scan left->right in stead
+    * of top->bottom, at least for now. */
    y = ((phase & 0xfffffff8) + offsets[phase % 8]) % hh;
    y2 = (y * VRoot.h) / hh;
 
-   ScaleLine(p->pmap, VRoot.win, xx, yy + y, VRoot.w, ww, y2, (VRoot.h / hh));
+   ScaleRect(VRoot.win, p->pmap, NULL, 0, y2, VRoot.w, VRoot.h / hh,
+            xx, yy + y, ww, 1, Conf.pagers.hiq);
    EClearArea(p->win, xx, yy + y, ww, 1, False);
-
+   y2 = p->h;
+#else
+   y = ((phase & 0xfffffff8) + offsets[phase % 8]) % ww;
+   y2 = (y * VRoot.w) / ww;
+
+   ScaleRect(VRoot.win, p->pmap, NULL, y2, 0, VRoot.w / ww, VRoot.h,
+            xx + y, yy, 1, hh, Conf.pagers.hiq);
+   EClearArea(p->win, xx + y, yy, 1, hh, False);
+   y2 = p->w;
+#endif
    p->update_phase++;
-   if (p->update_phase >= p->h)
+   if (p->update_phase >= y2)
      {
        int                 i, num;
        EWin               *const *lst;
@@ -245,11 +287,10 @@
          }
        else
          {
-            ewin->mini_pmm.type = 0;
-            ewin->mini_pmm.pmap = ECreatePixmap(p->win, w, h, VRoot.depth);
+            ewin->mini_pmm.type = 1;
             ewin->mini_pmm.mask = None;
-            ScaleRect(ewin->mini_pmm.pmap, EoGetWin(ewin), 0, 0, 0, 0,
-                      EoGetW(ewin), EoGetH(ewin), w, h);
+            ScaleRect(EoGetWin(ewin), None, &ewin->mini_pmm.pmap, 0, 0,
+                      EoGetW(ewin), EoGetH(ewin), 0, 0, w, h, Conf.pagers.hiq);
          }
      }
 
@@ -471,7 +512,8 @@
    xx = cx * ww;
    yy = cy * hh;
 
-   ScaleRect(p->pmap, VRoot.win, 0, 0, xx, yy, VRoot.w, VRoot.h, ww, hh);
+   ScaleRect(VRoot.win, p->pmap, NULL, 0, 0, VRoot.w, VRoot.h, xx, yy, ww, hh,
+            Conf.pagers.hiq);
    EClearWindow(p->win);
 
    lst = EwinListGetForDesk(&num, p->desktop);




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to