Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/evas

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


Modified Files:
        evas_gl_common.h evas_gl_gradient.c evas_gl_image.c 
        evas_gl_texture.c 


Log Message:


cedric's cache changes patch

===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_common.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- evas_gl_common.h    25 Dec 2007 11:12:39 -0000      1.16
+++ evas_gl_common.h    12 Apr 2008 00:32:26 -0000      1.17
@@ -21,7 +21,7 @@
 #include <unistd.h>
 
 #ifdef BUILD_ENGINE_GL_GLEW
-# include <GL/glew.h>
+#include <GL/glew.h>
 #endif /* BUILD_ENGINE_GL_GLEW */
 
 #include <GL/gl.h>
@@ -196,8 +196,8 @@
 void              evas_gl_common_ycbcr601pl_texture_update(Evas_GL_Texture 
*tex, unsigned char **rows, int w, int h, int smooth);
     
 Evas_GL_Image    *evas_gl_common_image_load(Evas_GL_Context *gc, const char 
*file, const char *key, Evas_Image_Load_Opts *lo);
-Evas_GL_Image    *evas_gl_common_image_new_from_data(Evas_GL_Context *gc, int 
w, int h, int *data, int alpha, int cspace);
-Evas_GL_Image    *evas_gl_common_image_new_from_copied_data(Evas_GL_Context 
*gc, int w, int h, int *data, int alpha, int cspace);
+Evas_GL_Image    *evas_gl_common_image_new_from_data(Evas_GL_Context *gc, int 
w, int h, DATA32 *data, int alpha, int cspace);
+Evas_GL_Image    *evas_gl_common_image_new_from_copied_data(Evas_GL_Context 
*gc, int w, int h, DATA32 *data, int alpha, int cspace);
 Evas_GL_Image    *evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h, 
int alpha, int cspace);
 void              evas_gl_common_image_free(Evas_GL_Image *im);
 void              evas_gl_common_image_dirty(Evas_GL_Image *im);
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_gradient.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- evas_gl_gradient.c  4 Aug 2007 12:33:12 -0000       1.7
+++ evas_gl_gradient.c  12 Apr 2008 00:32:26 -0000      1.8
@@ -1,7 +1,5 @@
 #include "evas_gl_private.h"
 
-static void _evas_gl_common_gradient_texture_build(Evas_GL_Context *gc, 
Evas_GL_Gradient *gr);
-
 Evas_GL_Gradient *
 evas_gl_common_gradient_new(void)
 {
@@ -211,9 +209,10 @@
      {
        RGBA_Image *im;
        int op = dc->render_op, cuse = dc->clip.use;
-       
-       im = evas_common_image_create(w, h);
-       if (!im) return;
+
+       im = (RGBA_Image *) 
evas_cache_image_empty(evas_common_image_cache_get());
+        if (!im) return;
+        im = (RGBA_Image *) evas_cache_image_size_set(&im->cache_entry, w, h);
        dc->render_op = _EVAS_RENDER_FILL;
        dc->clip.use = 0;
        evas_common_gradient_draw(im, dc, 0, 0, w, h, gr->grad);
@@ -221,8 +220,9 @@
          gr->tex = evas_gl_common_texture_new(gc, im, 0);
        else
          evas_gl_common_texture_update(gr->tex, im, 0);
-       
-       evas_common_image_delete(im);
+
+       evas_cache_image_drop(&im->cache_entry);
+
        dc->render_op = op;
        dc->clip.use = cuse;
        if (!gr->tex) return;
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_image.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- evas_gl_image.c     25 Dec 2007 11:12:39 -0000      1.10
+++ evas_gl_image.c     12 Apr 2008 00:32:26 -0000      1.11
@@ -3,9 +3,9 @@
 Evas_GL_Image *
 evas_gl_common_image_load(Evas_GL_Context *gc, const char *file, const char 
*key, Evas_Image_Load_Opts *lo)
 {
-   Evas_GL_Image *im;
-   RGBA_Image *im_im;
-   Evas_List *l;
+   Evas_GL_Image        *im;
+   RGBA_Image           *im_im;
+   Evas_List            *l;
 
    im_im = evas_common_load_image_from_file(file, key, lo);
    if (!im_im) return NULL;
@@ -15,7 +15,7 @@
        im = l->data;
        if (im->im == im_im)
          {
-             evas_cache_image_drop(im_im);
+             evas_cache_image_drop(&im_im->cache_entry);
             gc->images = evas_list_remove_list(gc->images, l);
             gc->images = evas_list_prepend(gc->images, im);
             im->references++;
@@ -42,7 +42,7 @@
 }
 
 Evas_GL_Image *
-evas_gl_common_image_new_from_data(Evas_GL_Context *gc, int w, int h, int 
*data, int alpha, int cspace)
+evas_gl_common_image_new_from_data(Evas_GL_Context *gc, int w, int h, DATA32 
*data, int alpha, int cspace)
 {
    Evas_GL_Image *im;
    Evas_List *l;
@@ -50,9 +50,9 @@
    for (l = gc->images; l; l = l->next)
      {
        im = l->data;
-       if (((void *)(im->im->image->data) == (void *)data) &&
-           (im->im->image->w == w) &&
-           (im->im->image->h == h))
+       if (((void *)(im->im->image.data) == (void *)data) &&
+           (im->im->cache_entry.w == w) &&
+           (im->im->cache_entry.h == h))
          {
             gc->images = evas_list_remove_list(gc->images, l);
             gc->images = evas_list_prepend(gc->images, im);
@@ -63,25 +63,18 @@
    im = calloc(1, sizeof(Evas_GL_Image));
    if (!im) return NULL;
    im->references = 1;
-   im->im = evas_cache_image_empty(evas_common_image_cache_get());
+   im->im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(),
+                                                 w, h, data, alpha, cspace);
    if (!im->im)
      {
        free(im);
        return NULL;
      }
    im->gc = gc;
-   im->im->image->w = w;
-   im->im->image->h = h;
    im->cs.space = cspace;
-   if (alpha)
-     im->im->flags |= RGBA_IMAGE_HAS_ALPHA;
-   else
-     im->im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
    switch (cspace)
      {
       case EVAS_COLORSPACE_ARGB8888:
-       im->im->image->data = data;
-       im->im->image->no_free = 1;
         break;
       case EVAS_COLORSPACE_YCBCR422P601_PL:
       case EVAS_COLORSPACE_YCBCR422P709_PL:
@@ -103,42 +96,34 @@
 }
 
 Evas_GL_Image *
-evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc, int w, int h, 
int *data, int alpha, int cspace)
+evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc, int w, int h, 
DATA32 *data, int alpha, int cspace)
 {
    Evas_GL_Image *im;
 
    im = calloc(1, sizeof(Evas_GL_Image));
    if (!im) return NULL;
    im->references = 1;
-   im->im = evas_cache_image_empty(evas_common_image_cache_get());
+   im->im = (RGBA_Image *) 
evas_cache_image_copied_data(evas_common_image_cache_get(),
+                                                        w, h, data, alpha, 
cspace);
    if (!im->im)
      {
        free(im);
        return NULL;
      }
-   im->im->image->w = w;
-   im->im->image->h = h;
    im->gc = gc;
    im->cs.space = cspace;
-   if (alpha)
-     im->im->flags |= RGBA_IMAGE_HAS_ALPHA;
-   else
-     im->im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
    switch (cspace)
      {
       case EVAS_COLORSPACE_ARGB8888:
-        evas_common_image_surface_alloc(im->im->image);
-       if (data)
-         memcpy(im->im->image->data, data, w * h * sizeof(DATA32));
        break;
       case EVAS_COLORSPACE_YCBCR422P601_PL:
       case EVAS_COLORSPACE_YCBCR422P709_PL:
         if (im->tex) evas_gl_common_texture_free(im->tex);
        im->tex = NULL;
        im->cs.no_free = 0;
-        im->cs.data = calloc(1, im->im->image->h * sizeof(unsigned char *) * 
2);
+        im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char 
*) * 2);
         if ((data) && (im->cs.data))
-         memcpy(im->cs.data, data, im->im->image->h * sizeof(unsigned char *) 
* 2);
+         memcpy(im->cs.data, data, im->im->cache_entry.h * sizeof(unsigned 
char *) * 2);
        break;
       default:
        abort();
@@ -155,37 +140,30 @@
    im = calloc(1, sizeof(Evas_GL_Image));
    if (!im) return NULL;
    im->references = 1;
-   im->im = evas_cache_image_empty(evas_common_image_cache_get());
+   im->im = (RGBA_Image *) 
evas_cache_image_empty(evas_common_image_cache_get());
    if (!im->im)
      {
        free(im);
        return NULL;
      }
-   im->im->image->w = w;
-   im->im->image->h = h;
    im->gc = gc;
    im->cs.space = cspace;
    if (alpha)
      im->im->flags |= RGBA_IMAGE_HAS_ALPHA;
    else
      im->im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
+   evas_cache_image_colorspace(&im->im->cache_entry, cspace);
+   im->im = (RGBA_Image *) evas_cache_image_size_set(&im->im->cache_entry, w, 
h);
    switch (cspace)
      {
       case EVAS_COLORSPACE_ARGB8888:
-        evas_common_image_surface_alloc(im->im->image);
-//     if (data)
-//       memcpy(im->im->image->data, data, w * h * sizeof(DATA32));
        break;
       case EVAS_COLORSPACE_YCBCR422P601_PL:
       case EVAS_COLORSPACE_YCBCR422P709_PL:
-        evas_common_image_surface_dealloc(im->im->image);
-        im->im->image->data = NULL;
 //        if (im->tex) evas_gl_common_texture_free(im->tex);
        im->tex = NULL;
        im->cs.no_free = 0;
-        im->cs.data = calloc(1, im->im->image->h * sizeof(unsigned char *) * 
2);
-//        if ((data) && (im->cs.data))
-//       memcpy(im->cs.data, data, im->im->image->h * sizeof(unsigned char *) 
* 2);
+        im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char 
*) * 2);
        break;
       default:
        abort();
@@ -205,7 +183,7 @@
        if (!im->cs.no_free) free(im->cs.data);
      }
    if (im->cached) im->gc->images = evas_list_remove(im->gc->images, im);
-   if (im->im) evas_cache_image_drop(im->im);
+   if (im->im) evas_cache_image_drop(&im->im->cache_entry);
    if (im->tex) evas_gl_common_texture_free(im->tex);
    free(im);
 }
@@ -213,7 +191,7 @@
 void
 evas_gl_common_image_dirty(Evas_GL_Image *im)
 {
-   im->im = evas_cache_image_dirty(im->im, 0, 0, im->im->image->w, 
im->im->image->h);
+   im->im = (RGBA_Image *) evas_cache_image_dirty(&im->im->cache_entry, 0, 0, 
im->im->cache_entry.w, im->im->cache_entry.h);
    im->dirty = 1;
 }
 
@@ -246,14 +224,14 @@
      {
         if ((im->cs.data) && (*((unsigned char **)im->cs.data)))
           {
-             if (im->dirty || !im->im->image->data)
+             if (im->dirty || !im->im->image.data)
                {
-                  free(im->im->image->data);
-                  im->im->image->data = malloc(im->im->image->w * 
im->im->image->h * sizeof(DATA32));
-                  if (im->im->image->data)
+                  free(im->im->image.data);
+                  im->im->image.data = malloc(im->im->cache_entry.w * 
im->im->cache_entry.h * sizeof(DATA32));
+                  if (im->im->image.data)
                     evas_common_convert_yuv_420p_601_rgba(im->cs.data, 
-                                                          (void 
*)im->im->image->data,
-                                                          im->im->image->w, 
im->im->image->h);
+                                                          (void 
*)im->im->image.data,
+                                                          
im->im->cache_entry.w, im->im->cache_entry.h);
                }
           }
         space = EVAS_COLORSPACE_ARGB8888;
@@ -265,7 +243,7 @@
    switch (space)
      {
       case EVAS_COLORSPACE_ARGB8888:
-        evas_cache_image_load_data(im->im);
+        evas_cache_image_load_data(&im->im->cache_entry);
        if ((im->tex) && (im->dirty))
          {
             evas_gl_common_texture_update(im->tex, im->im, im->tex->smooth);
@@ -295,12 +273,12 @@
       case EVAS_COLORSPACE_YCBCR422P709_PL:
        if ((im->tex) && (im->dirty))
          {
-            evas_gl_common_ycbcr601pl_texture_update(im->tex, im->cs.data, 
im->im->image->w, im->im->image->h, smooth);
+            evas_gl_common_ycbcr601pl_texture_update(im->tex, im->cs.data, 
im->im->cache_entry.w, im->im->cache_entry.h, smooth);
             im->dirty = 0;
          }
        if ((!im->tex) && (im->cs.data) && (*((unsigned char **)im->cs.data)))
          {
-            im->tex = evas_gl_common_ycbcr601pl_texture_new(gc, im->cs.data, 
im->im->image->w, im->im->image->h, smooth);
+            im->tex = evas_gl_common_ycbcr601pl_texture_new(gc, im->cs.data, 
im->im->cache_entry.w, im->im->cache_entry.h, smooth);
          }
        if (!im->tex) return;
        ow = (dw * im->tex->tw) / sw;
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_texture.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- evas_gl_texture.c   4 Aug 2007 09:54:35 -0000       1.11
+++ evas_gl_texture.c   12 Apr 2008 00:32:26 -0000      1.12
@@ -4,7 +4,7 @@
 evas_gl_common_texture_new(Evas_GL_Context *gc, RGBA_Image *im, int smooth)
 {
    Evas_GL_Texture *tex;
-   int *im_data;
+   DATA32 *im_data;
    int im_w, im_h;
    int tw, th;
    int shift;
@@ -13,16 +13,16 @@
    tex = calloc(1, sizeof(Evas_GL_Texture));
    if (!tex) return NULL;
 
-   if ((gc->ext.nv_texture_rectangle) && 
-       (!(gc->ext.arb_texture_non_power_of_two && 
+   if ((gc->ext.nv_texture_rectangle) &&
+       (!(gc->ext.arb_texture_non_power_of_two &&
          gc->ext.sgis_generate_mipmap)))
      {
        tex->gc = gc;
-       tex->w = im->image->w;
-       tex->h = im->image->h;
+       tex->w = im->cache_entry.w;
+       tex->h = im->cache_entry.h;
        tex->rectangle = 1;
-       tex->tw = im->image->w;
-       tex->th = im->image->h;
+       tex->tw = im->cache_entry.w;
+       tex->th = im->cache_entry.h;
        tex->references = 0;
        tex->smooth = smooth;
        tex->changed = 1;
@@ -53,25 +53,25 @@
 
        glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0,
                     texfmt, tex->w, tex->h, 0,
-                    pixfmt, NATIVE_PIX_UNIT, im->image->data);
+                    pixfmt, NATIVE_PIX_UNIT, im->image.data);
        return tex;
      }
 
    if ((gc->ext.arb_texture_non_power_of_two) && 
(gc->ext.sgis_generate_mipmap))
      {
-       tw = im->image->w;
-       th = im->image->h;
+       tw = im->cache_entry.w;
+       th = im->cache_entry.h;
      }
    else
      {
-       shift = 1; while (im->image->w > shift) shift = shift << 1; tw = shift;
-       shift = 1; while (im->image->h > shift) shift = shift << 1; th = shift;
+       shift = 1; while (im->cache_entry.w > shift) shift = shift << 1; tw = 
shift;
+       shift = 1; while (im->cache_entry.h > shift) shift = shift << 1; th = 
shift;
      }
    tex->gc = gc;
    tex->w = tw;
    tex->h = th;
-   tex->tw = im->image->w;
-   tex->th = im->image->h;
+   tex->tw = im->cache_entry.w;
+   tex->th = im->cache_entry.h;
    tex->references = 0;
    tex->smooth = 0;
    tex->changed = 1;
@@ -84,15 +84,15 @@
    tex->references++;
 
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16);
-   
+
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 
-   im_data = im->image->data;
-   im_w = im->image->w;
-   im_h = im->image->h;
+   im_data = im->image.data;
+   im_w = im->cache_entry.w;
+   im_h = im->cache_entry.h;
 
    if (im->flags & RGBA_IMAGE_HAS_ALPHA) texfmt = GL_RGBA8;
    else texfmt = GL_RGB8;
@@ -152,7 +152,7 @@
 void
 evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im, int smooth)
 {
-   int *im_data;
+   DATA32 *im_data;
    int im_w, im_h;
    int tw, th;
    GLenum pixfmt, texfmt, target;
@@ -165,7 +165,7 @@
        glEnable(GL_TEXTURE_RECTANGLE_NV);
        glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex->texture);
 
-       data = im->image->data;
+       data = im->image.data;
 #if 0 // trying the glXAllocateMemoryNV() thing but its abysmally slow
        tmp = glXAllocateMemoryNV(tex->w * tex->h * sizeof(DATA32),
                                  0.0, 1.0, 1.0);
@@ -177,7 +177,7 @@
                                tmp);
 //          evas_common_copy_pixels_rgba_to_rgba_mmx2(im->image->data, tmp,
 //                                                    tex->w * tex->h);
-            memcpy(tmp, im->image->data,
+            memcpy(tmp, im->image.data,
                    tex->w * tex->h * sizeof(DATA32));
             data = tmp;
          }
@@ -245,9 +245,9 @@
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    tex->smooth = 0;
 
-   im_data = im->image->data;
-   im_w = im->image->w;
-   im_h = im->image->h;
+   im_data = im->image.data;
+   im_w = im->cache_entry.w;
+   im_h = im->cache_entry.h;
 
    if (im->flags & RGBA_IMAGE_HAS_ALPHA) texfmt = GL_RGBA8;
    else texfmt = GL_RGB8;
@@ -312,7 +312,7 @@
 void
 evas_gl_common_texture_mipmaps_build(Evas_GL_Texture *tex, RGBA_Image *im, int 
smooth)
 {
-   int *im_data;
+   DATA32 *im_data;
    int tw, th;
    int im_w, im_h, w, h;
    GLenum pixfmt, texfmt;
@@ -329,8 +329,8 @@
 #endif
    tw = tex->w;
    th = tex->h;
-   w = im->image->w;
-   h = im->image->h;
+   w = im->cache_entry.w;
+   h = im->cache_entry.h;
    level = 0;
    im1 = im;
 
@@ -365,30 +365,31 @@
        th /= 2;
 
        level++;
-       im2 = evas_common_image_create(w, h);
+       im2 = (RGBA_Image *) 
evas_cache_image_empty(evas_common_image_cache_get());
+        im2 = (RGBA_Image *) evas_cache_image_size_set(&im2->cache_entry, w, 
h);
 #ifdef BUILD_MMX
        if (mmx)
          {
-            evas_common_scale_rgba_mipmap_down_2x2_mmx(im1->image->data,
-                                                       im2->image->data,
+            evas_common_scale_rgba_mipmap_down_2x2_mmx(im1->image.data,
+                                                       im2->image.data,
                                                        pw, ph);
          }
        else
 #endif
          {
             if (im->flags & RGBA_IMAGE_HAS_ALPHA)
-              evas_common_scale_rgba_mipmap_down_2x2_c(im1->image->data,
-                                                       im2->image->data,
+              evas_common_scale_rgba_mipmap_down_2x2_c(im1->image.data,
+                                                       im2->image.data,
                                                        pw, ph);
             else
-              evas_common_scale_rgb_mipmap_down_2x2_c(im1->image->data,
-                                                      im2->image->data,
+              evas_common_scale_rgb_mipmap_down_2x2_c(im1->image.data,
+                                                      im2->image.data,
                                                       pw, ph);
          }
-       if (im1 != im) evas_cache_image_drop(im1);
+       if (im1 != im) evas_cache_image_drop(&im1->cache_entry);
        im1 = NULL;
 
-       im_data = im2->image->data;
+       im_data = im2->image.data;
        im_w = w;
        im_h = h;
        glTexSubImage2D(GL_TEXTURE_2D, level,
@@ -413,7 +414,7 @@
        im1 = im2;
        im2 = NULL;
      }
-   if ((im1 != im) && (im1)) evas_common_image_delete(im1);
+   if ((im1 != im) && (im1)) evas_cache_image_drop(&im1->cache_entry);
    tex->have_mipmaps = 1;
 #ifdef BUILD_MMX
    if (mmx) evas_common_cpu_end_opt();



-------------------------------------------------------------------------
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