Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/modules/engines/xrender_x11


Modified Files:
        evas_engine.c evas_engine.h evas_engine_font.c 
        evas_engine_image.c evas_engine_ximage.c evas_engine_xrender.c 


Log Message:


if xrender is on a 16bpp target - do some "faster" paths - i hope.

===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- evas_engine.c       16 Jul 2007 07:25:34 -0000      1.20
+++ evas_engine.c       7 Apr 2008 23:07:23 -0000       1.21
@@ -251,7 +251,7 @@
        _xr_render_surface_solid_rectangle_set(surface, 0, 0, 0, 0, 0, 0, uw, 
uh);
        return surface;
      }
-   return _xr_render_surface_new(re->xinf, uw, uh, re->xinf->fmt24, 0);
+   return _xr_render_surface_new(re->xinf, uw, uh, re->xinf->fmtdef, 0);
 }
 
 static void
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- evas_engine.h       29 Dec 2006 03:32:46 -0000      1.9
+++ evas_engine.h       7 Apr 2008 23:07:23 -0000       1.10
@@ -28,6 +28,7 @@
    XRenderPictFormat *fmt8;
    XRenderPictFormat *fmt4;
    XRenderPictFormat *fmt1;
+   XRenderPictFormat *fmtdef;
    unsigned char      mul_r, mul_g, mul_b, mul_a;
    Xrender_Surface   *mul;
    int                references;
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine_font.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- evas_engine_font.c  8 Feb 2008 20:42:10 -0000       1.3
+++ evas_engine_font.c  7 Apr 2008 23:07:23 -0000       1.4
@@ -12,6 +12,7 @@
    DATA8 *data;
    int w, h, j;
    XRenderPictureAttributes att;
+   XRenderPictFormat *fmt;
    Ximage_Image  *xim;
    Evas_Hash *pool;
    char buf[256], buf2[256];
@@ -52,14 +53,18 @@
    snprintf(buf2, sizeof(buf2), "%p", fg);
    pool = evas_hash_add(pool, buf2, fs);
    _xr_fg_pool = evas_hash_add(_xr_fg_pool, buf, pool);
-   
-   fs->draw = XCreatePixmap(xinf->disp, xinf->root, w, h, xinf->fmt8->depth);
+
+   /* FIXME: maybe use fmt4? */
+   fmt = xinf->fmt8;
+   fs->draw = XCreatePixmap(xinf->disp, xinf->root, w, h,fmt->depth);
    att.dither = 0;
    att.component_alpha = 0;
    att.repeat = 0;
-   fs->pic = XRenderCreatePicture(xinf->disp, fs->draw, xinf->fmt8, CPRepeat | 
CPDither | CPComponentAlpha, &att);
+   fs->pic = XRenderCreatePicture(xinf->disp, fs->draw,fmt, 
+                                 CPRepeat | CPDither | CPComponentAlpha, &att);
    
-   xim = _xr_image_new(fs->xinf, w, h, xinf->fmt8->depth);
+   /* FIXME: handle if fmt->depth != 8 */
+   xim = _xr_image_new(fs->xinf, w, h,fmt->depth);
    if ((fg->glyph_out->bitmap.num_grays == 256) &&
        (fg->glyph_out->bitmap.pixel_mode == ft_pixel_mode_grays))
      {
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine_image.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- evas_engine_image.c 16 Jul 2007 07:25:34 -0000      1.13
+++ evas_engine_image.c 7 Apr 2008 23:07:23 -0000       1.14
@@ -490,7 +490,16 @@
             if (im->alpha)
               im->surface = _xr_render_surface_new(im->xinf, im->w + 2, im->h 
+ 2, im->xinf->fmt32, 1);
             else
-              im->surface = _xr_render_surface_new(im->xinf, im->w + 2, im->h 
+ 2, im->xinf->fmt24, 0);
+              {
+                 /* FIXME: if im->depth == 16, use xinf->fmtdef */
+                 if ((im->xinf->depth == 16) &&
+                     (im->xinf->vis->red_mask == 0xf800) &&
+                     (im->xinf->vis->green_mask == 0x07e0) &&
+                     (im->xinf->vis->blue_mask == 0x001f))
+                   im->surface = _xr_render_surface_new(im->xinf, im->w + 2, 
im->h + 2, im->xinf->fmtdef, 0);
+                 else
+                   im->surface = _xr_render_surface_new(im->xinf, im->w + 2, 
im->h + 2, im->xinf->fmt24, 0);
+              }
             if (im->surface)
               _xr_render_surface_copy(old_surface, im->surface, 0, 0, 0, 0, 
im->w + 2, im->h + 2);
             _xr_render_surface_free(old_surface);
@@ -597,6 +606,8 @@
                       if (im->alpha)
                         _xr_render_surface_argb_pixels_fill(im->surface, 
im->w, im->h, data, rx, ry, rw, rh, 1, 1);
                       else
+                      /* FIXME: if im->depth == 16 - convert to 16bpp then
+                       * upload */
                         _xr_render_surface_rgb_pixels_fill(im->surface, im->w, 
im->h, data, rx, ry, rw, rh, 1, 1);
                    }
                  evas_common_tilebuf_free_render_rects(rects);
@@ -614,7 +625,16 @@
      }
    else
      {
-       im->surface = _xr_render_surface_new(im->xinf, im->w + 2, im->h + 2, 
im->xinf->fmt24, 0);
+       /* FIXME: if im->xinf->depth == 16, use xinf->fmtdef */
+       if ((im->xinf->depth == 16) &&
+           (im->xinf->vis->red_mask == 0xf800) &&
+           (im->xinf->vis->green_mask == 0x07e0) &&
+           (im->xinf->vis->blue_mask == 0x001f))
+         im->surface = _xr_render_surface_new(im->xinf, im->w + 2, im->h + 2, 
im->xinf->fmtdef, 0);
+       else
+         im->surface = _xr_render_surface_new(im->xinf, im->w + 2, im->h + 2, 
im->xinf->fmt24, 0);
+       /* FIXME: if im->depth == 16 - convert to 16bpp then
+        * upload */
        _xr_render_surface_rgb_pixels_fill(im->surface, im->w, im->h, data, 0, 
0, im->w, im->h, 1, 1);
      }
    /* fill borders */
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine_ximage.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- evas_engine_ximage.c        14 Jan 2006 12:13:38 -0000      1.1
+++ evas_engine_ximage.c        7 Apr 2008 23:07:23 -0000       1.2
@@ -37,13 +37,18 @@
    xinf->references = 1;
    xinf->disp = disp;
    xinf->draw = draw;
-   XGetGeometry(xinf->disp, xinf->draw, &(xinf->root), &di, &di, &dui, &dui, 
&dui, &dui);
+   XGetGeometry(xinf->disp, xinf->draw, &(xinf->root),
+               &di, &di, &dui, &dui, &dui, &dui);
    xinf->vis = vis;
    xinf->fmt32 = XRenderFindStandardFormat(xinf->disp, PictStandardARGB32);
    xinf->fmt24 = XRenderFindStandardFormat(xinf->disp, PictStandardRGB24);
    xinf->fmt8 = XRenderFindStandardFormat(xinf->disp, PictStandardA8);
    xinf->fmt4 = XRenderFindStandardFormat(xinf->disp, PictStandardA4);
    xinf->fmt1 = XRenderFindStandardFormat(xinf->disp, PictStandardA1);
+   
+   /* find fmt for default visual */
+   xinf->fmtdef = XRenderFindVisualFormat(xinf->disp, xinf->vis);
+   
    xinf->mul = _xr_render_surface_new(xinf, 1, 1, xinf->fmt32, 1);
    _xr_render_surface_repeat_set(xinf->mul, 1);
    xinf->mul_r = xinf->mul_g = xinf->mul_b = xinf->mul_a = 0xff;
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine_xrender.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- evas_engine_xrender.c       4 Apr 2007 09:55:40 -0000       1.29
+++ evas_engine_xrender.c       7 Apr 2008 23:07:23 -0000       1.30
@@ -46,10 +46,11 @@
        return NULL;
      }
    rs->xinf->references++;
-   att.dither = 0;
+   att.dither = 1;
    att.component_alpha = 0;
    att.repeat = 0;
-   rs->pic = XRenderCreatePicture(xinf->disp, rs->draw, fmt, CPRepeat | 
CPDither | CPComponentAlpha, &att);
+   rs->pic = XRenderCreatePicture(xinf->disp, rs->draw, fmt, 
+                                 CPRepeat | CPDither | CPComponentAlpha, &att);
    if (rs->pic == None)
      {
        XFreePixmap(rs->xinf->disp, rs->draw);
@@ -82,10 +83,11 @@
    rs->allocated = 0;
    rs->draw = draw;
    rs->xinf->references++;
-   att.dither = 0;
+   att.dither = 1;
    att.component_alpha = 0;
    att.repeat = 0;
-   rs->pic = XRenderCreatePicture(xinf->disp, rs->draw, fmt, CPRepeat | 
CPDither | CPComponentAlpha, &att);
+   rs->pic = XRenderCreatePicture(xinf->disp, rs->draw, fmt, 
+                                 CPRepeat | CPDither | CPComponentAlpha, &att);
    if (rs->pic == None)
      {
        rs->xinf->references--;
@@ -223,38 +225,62 @@
    if (!xim) return;
    p = (unsigned int *)xim->data;
    sp = ((unsigned int *)pixels) + (y * sw) + x;
-   jump = ((xim->line_bytes / 4) - w);
    sjump = sw - w;
    spe = sp + ((h - 1) * sw) + w;
-   if
+   if (rs->depth == 16)
+     {
+       jump = ((xim->line_bytes / 2) - w);
+       /* FIXME: if rs->depth == 16 - convert */
+       Gfx_Func_Convert conv_func;
+       int swap;
+       
 #ifdef WORDS_BIGENDIAN
-     (xim->xim->byte_order == LSBFirst)
+       swap = (int)(xim->xim->byte_order == LSBFirst);
 #else
-     (xim->xim->byte_order == MSBFirst)
+       swap = (int)(xim->xim->byte_order == MSBFirst);
 #endif
-     {
-       while (sp < spe)
-         {
-            sple = sp + w;
-            while (sp < sple)
-              {
-                 *p++ = (*sp << 24) + ((*sp << 8) & 0xff0000) + ((*sp >> 8) & 
0xff00) + 0xff;
-//               *p++ = ((B_VAL(sp)) << 24) | ((G_VAL(sp)) << 16) | 
((R_VAL(sp)) << 8) | 0x000000ff;
-                 sp++;
-              }
-            p += jump;
-            sp += sjump;
-         }
+       /* FIXME: swap not handled */
+       conv_func = evas_common_convert_func_get(sp, w, h, rs->depth,
+                                                rs->xinf->vis->red_mask,
+                                                rs->xinf->vis->green_mask,
+                                                rs->xinf->vis->blue_mask,
+                                                PAL_MODE_NONE, 0);
+       if (conv_func)
+         conv_func(sp, p, sjump, jump, w, h, x, y, NULL);
      }
    else
      {
-       while (sp < spe)
+       jump = ((xim->line_bytes / 4) - w);
+       if
+#ifdef WORDS_BIGENDIAN
+         (xim->xim->byte_order == LSBFirst)
+#else
+         (xim->xim->byte_order == MSBFirst)
+#endif
+           {
+              while (sp < spe)
+                {
+                   sple = sp + w;
+                   while (sp < sple)
+                     {
+                        *p++ = (*sp << 24) + ((*sp << 8) & 0xff0000) + ((*sp 
>> 8) & 0xff00) + 0xff;
+//               *p++ = ((B_VAL(sp)) << 24) | ((G_VAL(sp)) << 16) | 
((R_VAL(sp)) << 8) | 0x000000ff;
+                        sp++;
+                     }
+                   p += jump;
+                   sp += sjump;
+                }
+           }
+       else
          {
-            sple = sp + w;
-            while (sp < sple)
-               *p++ = 0xff000000 | *sp++;
-            p += jump;
-            sp += sjump;
+            while (sp < spe)
+              {
+                 sple = sp + w;
+                 while (sp < sple)
+                   *p++ = 0xff000000 | *sp++;
+                 p += jump;
+                 sp += sjump;
+              }
          }
      }
    _xr_image_put(xim, rs->draw, x + ox, y + oy, w, h);



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to