Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/evas

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


Modified Files:
        evas_engine.c evas_engine.h evas_x_buffer.c 


Log Message:


cedric's cache changes patch

===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/software_16_x11/evas_engine.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- evas_engine.c       11 Oct 2007 14:43:05 -0000      1.6
+++ evas_engine.c       12 Apr 2008 00:32:27 -0000      1.7
@@ -2,7 +2,7 @@
 #include "evas_private.h"
 #include "evas_engine.h"
 #include "Evas_Engine_Software_16_X11.h"
-#include "evas_soft16.h"
+#include "evas_common_soft16.h"
 
 /* function tables - filled in later (func and parent func) */
 static Evas_Func func, pfunc;
@@ -65,13 +65,6 @@
 }
 
 static void
-_tmp_out_free(Soft16_Image *tmp_out)
-{
-   free(tmp_out->pixels);
-   free(tmp_out);
-}
-
-static void
 _tmp_out_alloc(Render_Engine *re)
 {
    Tilebuf_Rect *r;
@@ -85,9 +78,9 @@
 
    if (re->tmp_out)
      {
-       if ((re->tmp_out->w < w) || (re->tmp_out->h < h))
+       if ((re->tmp_out->cache_entry.w < w) || (re->tmp_out->cache_entry.h < 
h))
          {
-            _tmp_out_free(re->tmp_out);
+             evas_cache_image_drop(&re->tmp_out->cache_entry);
             re->tmp_out = NULL;
          }
      }
@@ -96,14 +89,9 @@
      {
        Soft16_Image *im;
 
-       im = calloc(1, sizeof(Soft16_Image));
-       im->w = w;
-       im->h = h;
-       im->stride = w + ((w % 4) ? (4 - (w % 4)) : 0);
-       im->have_alpha = 0;
-       im->references = 1;
-       im->free_pixels = 1;
-       im->pixels = malloc(h * im->stride * sizeof(DATA16));
+        im = (Soft16_Image *) 
evas_cache_image_empty(evas_common_soft16_image_cache_get());
+        im->flags.have_alpha = 0;
+        evas_cache_image_surface_alloc(&im->cache_entry, w, h);
 
        re->tmp_out = im;
      }
@@ -115,7 +103,7 @@
 {
    Render_Engine *re;
    Evas_Engine_Info_Software_16_X11 *info;
-   X_Output_Buffer *xob;
+/*    X_Output_Buffer *xob; */
    XGCValues gcv;
    
    info = (Evas_Engine_Info_Software_16_X11 *)in;
@@ -144,7 +132,8 @@
        evas_common_font_init();
        evas_common_draw_init();
        evas_common_tilebuf_init();
-       
+       evas_common_soft16_image_init();
+
        /* render engine specific data */
        re = calloc(1, sizeof(Render_Engine));
        e->engine.data.output = re;
@@ -179,7 +168,7 @@
          evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
        if (re->tmp_out)
          {
-            _tmp_out_free(re->tmp_out);
+             evas_cache_image_drop(&re->tmp_out->cache_entry);
             re->tmp_out = NULL;
          }
      }
@@ -203,11 +192,12 @@
    if (re->gc) XFreeGC(re->disp, re->gc);
    if (re->tb) evas_common_tilebuf_free(re->tb);
    if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
-   if (re->tmp_out) _tmp_out_free(re->tmp_out);
+   if (re->tmp_out) evas_cache_image_drop(&re->tmp_out->cache_entry);
    free(re);
 
    evas_common_font_shutdown();
    evas_common_image_shutdown();
+   evas_common_soft16_image_shutdown();
 }
 
 static void
@@ -237,7 +227,7 @@
      }
    if (re->tmp_out)
      {
-       _tmp_out_free(re->tmp_out);
+        evas_cache_image_drop(&re->tmp_out->cache_entry);
        re->tmp_out = NULL;
      }
 }
@@ -343,7 +333,7 @@
    if (re->rot == 0)
      {
        *cx = ux; *cy = uy; *cw = uw; *ch = uh;
-       return &re->shbuf->im;
+       return re->shbuf->im;
      }
    else
      {
@@ -449,10 +439,10 @@
    DATA16 *dp, *sp;
    int y, x, d_dir;
 
-   d = &re->shbuf->im;
+   d = re->shbuf->im;
    s = re->tmp_out;
 
-   if ((w < 1) || (h < 1) || (out_x >= d->w) || (out_y >= d->h))
+   if ((w < 1) || (h < 1) || (out_x >= d->cache_entry.w) || (out_y >= 
d->cache_entry.h))
      return;
 
    if (re->rot == 90)
@@ -524,7 +514,7 @@
    else return;
 
    evas_software_x11_x_output_buffer_paste
-     (re->shbuf, re->draw, re->gc, 0, 0, re->shbuf->im.w, re->shbuf->im.h, 1);
+     (re->shbuf, re->draw, re->gc, 0, 0, re->shbuf->im->cache_entry.w, 
re->shbuf->im->cache_entry.h, 1);
    XSetClipMask(re->disp, re->gc, None);
 }
 
@@ -546,7 +536,7 @@
      }
    if (re->tmp_out)
      {
-       _tmp_out_free(re->tmp_out);
+        evas_cache_image_drop(&re->tmp_out->cache_entry);
        re->tmp_out = NULL;
      }
 }
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/software_16_x11/evas_engine.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- evas_engine.h       29 Apr 2007 15:45:40 -0000      1.1
+++ evas_engine.h       12 Apr 2008 00:32:27 -0000      1.2
@@ -8,13 +8,13 @@
 #include <sys/ipc.h>
 #include <sys/shm.h>
 
-#include "evas_soft16.h"
+#include "evas_common_soft16.h"
 
 typedef struct _X_Output_Buffer       X_Output_Buffer;
 
 struct _X_Output_Buffer
 {
-   Soft16_Image    im;
+   Soft16_Image    *im;
    Display         *display;
    XImage          *xim;
    XShmSegmentInfo *shm_info;
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/software_16_x11/evas_x_buffer.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- evas_x_buffer.c     29 Apr 2007 15:45:40 -0000      1.1
+++ evas_x_buffer.c     12 Apr 2008 00:32:27 -0000      1.2
@@ -81,11 +81,9 @@
                            XSetErrorHandler((XErrorHandler)ph);
                            if (!_x_err)
                              {
-                                xob->im.pixels = xob->xim->data;
-                                xob->im.w = w;
-                                xob->im.h = h;
-                                xob->im.stride = xob->xim->bytes_per_line / 
sizeof(DATA16);
-                                xob->im.references = 1;
+                                 xob->im = (Soft16_Image *) 
evas_cache_image_data(evas_common_soft16_image_cache_get(), w, h, (DATA32 *) 
xob->xim->data, 0, EVAS_COLORSPACE_RGB565_A5P);
+                                 if (xob->im)
+                                   xob->im->stride = xob->xim->bytes_per_line 
/ sizeof(DATA16);
                                 return xob;
                              }
                         }
@@ -121,11 +119,12 @@
             return NULL;
          }
      }
-   xob->im.pixels = xob->xim->data;
-   xob->im.w = w;
-   xob->im.h = h;
-   xob->im.stride = xob->xim->bytes_per_line / sizeof(DATA16);
-   xob->im.references = 1;
+   if (xob->im)
+     evas_cache_image_drop(&xob->im->cache_entry);
+
+   xob->im =  (Soft16_Image *) 
evas_cache_image_data(evas_common_soft16_image_cache_get(), w, h, (DATA32 *) 
xob->xim->data, 0, EVAS_COLORSPACE_RGB565_A5P);
+   if (xob->im)
+     xob->im->stride = xob->xim->bytes_per_line / sizeof(DATA16);
    return xob;
 }
 



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
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