Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/lib/engines/xrender_x11
Modified Files:
evas_engine.c evas_engine.h evas_engine_image.c
Log Message:
was playing with ansiotropic filtering - with mipmap stuff it looks nicer.
stillnot perfect. xrender engine detects "same source data pointer" and
shares nicely now :)
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/xrender_x11/evas_engine.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- evas_engine.c 3 Oct 2005 12:46:15 -0000 1.6
+++ evas_engine.c 6 Oct 2005 02:38:34 -0000 1.7
@@ -772,14 +772,22 @@
XR_Image *old_image;
old_image = (XR_Image *)image;
- image = _xre_image_new_from_data(old_image->xinf, old_image->w,
old_image->h, image_data);
- if (image)
+ image = _xre_image_data_find(image_data);
+ if (!image)
{
- ((XR_Image *)image)->alpha = old_image->alpha;
- _xre_image_free(old_image);
+ image = _xre_image_new_from_data(old_image->xinf, old_image->w,
old_image->h, image_data);
+ if (image)
+ {
+ ((XR_Image *)image)->alpha = old_image->alpha;
+ _xre_image_free(old_image);
+ }
+ else
+ image = old_image;
}
else
- image = old_image;
+ {
+ _xre_image_free(old_image);
+ }
}
return image;
}
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/xrender_x11/evas_engine.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- evas_engine.h 3 Oct 2005 03:34:21 -0000 1.2
+++ evas_engine.h 6 Oct 2005 02:38:34 -0000 1.3
@@ -111,6 +111,7 @@
void _xre_image_dirty(XR_Image *im);
XR_Image *_xre_image_copy(XR_Image *im);
void *_xre_image_data_get(XR_Image *im);
+XR_Image *_xre_image_data_find(void *data);
void _xre_image_data_put(XR_Image *im, void *data);
void _xre_image_alpha_set(XR_Image *im, int alpha);
int _xre_image_alpha_get(XR_Image *im);
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/xrender_x11/evas_engine_image.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- evas_engine_image.c 3 Oct 2005 12:46:15 -0000 1.4
+++ evas_engine_image.c 6 Oct 2005 02:38:34 -0000 1.5
@@ -8,6 +8,36 @@
static int _xr_image_cache_size = 0;
static int _xr_image_cache_usage = 0;
static Evas_List *_xr_image_cache = NULL;
+static Evas_Hash *_xr_image_dirty_hash = NULL;
+
+static void
+__xre_image_dirty_hash_add(XR_Image *im)
+{
+ char buf[64];
+
+ if (!im->data) return;
+ snprintf(buf, sizeof(buf), "%p", im->data);
+ _xr_image_dirty_hash = evas_hash_add(_xr_image_dirty_hash, buf, im);
+}
+
+static void
+__xre_image_dirty_hash_del(XR_Image *im)
+{
+ char buf[64];
+
+ if (!im->data) return;
+ snprintf(buf, sizeof(buf), "%p", im->data);
+ _xr_image_dirty_hash = evas_hash_del(_xr_image_dirty_hash, buf, im);
+}
+
+static XR_Image *
+__xre_image_dirty_hash_find(void *data)
+{
+ char buf[64];
+
+ snprintf(buf, sizeof(buf), "%p", data);
+ return evas_hash_find(_xr_image_dirty_hash, buf);
+}
static XR_Image *
__xre_image_find(char *fkey)
@@ -91,6 +121,7 @@
im->data = data;
im->alpha = 1;
im->dirty = 1;
+ __xre_image_dirty_hash_add(im);
return im;
}
@@ -107,13 +138,6 @@
free(im);
return NULL;
}
- im->w = w;
- im->h = h;
- im->references = 1;
- im->xinf = xinf;
- im->xinf->references++;
- im->free_data = 1;
-
if (data)
{
Gfx_Func_Blend_Src_Dst func;
@@ -122,9 +146,15 @@
if (func) func(data, im->data, w * h);
evas_common_cpu_end_opt();
}
-
+ im->w = w;
+ im->h = h;
+ im->references = 1;
+ im->xinf = xinf;
+ im->xinf->references++;
+ im->free_data = 1;
im->alpha = 1;
im->dirty = 1;
+ __xre_image_dirty_hash_add(im);
return im;
}
@@ -135,20 +165,21 @@
im = calloc(1, sizeof(XR_Image));
if (!im) return NULL;
- im->xinf = xinf;
- im->xinf->references++;
- im->w = w;
- im->h = h;
- im->references = 1;
im->data = malloc(w * h * 4);
if (!im->data)
{
- im->xinf->references--;
free(im);
+ return NULL;
}
+ im->w = w;
+ im->h = h;
+ im->references = 1;
+ im->xinf = xinf;
+ im->xinf->references++;
im->free_data = 1;
im->alpha = 1;
im->dirty = 1;
+ __xre_image_dirty_hash_add(im);
return im;
}
@@ -159,6 +190,7 @@
if (im->key) free(im->key);
if (im->fkey) free(im->fkey);
if (im->im) evas_common_image_unref(im->im);
+ if ((im->data) && (im->dirty)) __xre_image_dirty_hash_del(im);
if ((im->free_data) && (im->data)) free(im->data);
if (im->surface) _xr_render_surface_free(im->surface);
if (im->format) free(im->format);
@@ -283,8 +315,10 @@
}
evas_common_cpu_end_opt();
}
+ __xre_image_dirty_hash_del(im);
free(im->data);
im->data = data;
+ __xre_image_dirty_hash_add(im);
}
else if (im->im)
{
@@ -312,12 +346,19 @@
evas_common_blit_rectangle(im_old, im->im, 0, 0, ww, hh, 0, 0);
evas_common_cpu_end_opt();
}
+ im->free_data = 1;
+ im->data = im->im->image->data;
+ im->im->image->data = NULL;
+ evas_common_image_unref(im->im);
+ im->im = NULL;
evas_common_image_unref(im_old);
+ __xre_image_dirty_hash_add(im);
}
else
{
im->data = malloc(w * h * 4);
im->free_data = 1;
+ __xre_image_dirty_hash_add(im);
}
im->w = w;
im->h = h;
@@ -341,6 +382,16 @@
return data;
}
+XR_Image *
+_xre_image_data_find(void *data)
+{
+ XR_Image *im;
+
+ im = __xre_image_dirty_hash_find(data);
+ if (im) im->references++;
+ return im;
+}
+
void
_xre_image_data_put(XR_Image *im, void *data)
{
@@ -351,6 +402,7 @@
{
imdata = im->data;
if (data == imdata) return;
+ __xre_image_dirty_hash_del(im);
if (im->free_data) free(im->data);
}
else
@@ -364,6 +416,7 @@
}
}
im->data = data;
+ __xre_image_dirty_hash_add(im);
im->free_data = 0;
if (im->surface)
{
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs