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_font.c evas_engine_gradient.c evas_engine_image.c Log Message: cedric's cache changes patch =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- evas_engine.c 7 Apr 2008 23:07:23 -0000 1.21 +++ evas_engine.c 12 Apr 2008 00:32:28 -0000 1.22 @@ -529,11 +529,11 @@ _xre_image_border_get((XR_Image *)image, l, r, t, b); } -static const char * +static char * eng_image_comment_get(void *data, void *image, char *key) { if (!image) return NULL; - return ((XR_Image *)image)->comment; + return strdup(((XR_Image *)image)->comment); } static char * @@ -551,6 +551,10 @@ if (!image) return; im = (XR_Image *)image; if (im->cs.space == cspace) return; + + if (im->im) evas_cache_image_drop(&im->im->cache_entry); + im->im = NULL; + switch (cspace) { case EVAS_COLORSPACE_ARGB8888: @@ -560,15 +564,11 @@ im->cs.data = NULL; im->cs.no_free = 0; } - if (im->im) evas_cache_image_drop(im->im); - im->im = NULL; break; case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: if ((im->free_data) && (im->data)) free(im->data); im->data = NULL; - if (im->im) evas_cache_image_drop(im->im); - im->im = NULL; if (im->cs.data) { if (!im->cs.no_free) free(im->cs.data); @@ -693,7 +693,7 @@ } im = (XR_Image *)image; if (im->im) - evas_common_load_image_data_from_file(im->im); + evas_cache_image_load_data(&im->im->cache_entry); switch (im->cs.space) { case EVAS_COLORSPACE_ARGB8888: @@ -832,35 +832,32 @@ static void eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y, int w, int h, int ow, int oh, const char *text) { - Render_Engine *re; - + Render_Engine *re; + RGBA_Image *im; + re = (Render_Engine *)data; - { - static RGBA_Image *im = NULL; - - if (!im) - { - im = evas_common_image_new(); - im->image = evas_common_image_surface_new(im); - im->image->no_free = 1; - } - im->image->w = ((Xrender_Surface *)surface)->w; - im->image->h = ((Xrender_Surface *)surface)->h; - _xr_render_surface_clips_set((Xrender_Surface *)surface, (RGBA_Draw_Context *)context, x, y, w, h); - im->image->data = surface; - evas_common_draw_context_font_ext_set(context, - re->xinf, - _xre_font_surface_new, - _xre_font_surface_free, - _xre_font_surface_draw); - evas_common_font_draw(im, context, font, x, y, text); - evas_common_draw_context_font_ext_set(context, - NULL, - NULL, - NULL, - NULL); - evas_common_cpu_end_opt(); - } + + _xr_render_surface_clips_set((Xrender_Surface *)surface, (RGBA_Draw_Context *)context, x, y, w, h); + + im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(), + ((Xrender_Surface *)surface)->w, + ((Xrender_Surface *)surface)->h, + surface, + 0, EVAS_COLORSPACE_ARGB8888); + evas_common_draw_context_font_ext_set(context, + re->xinf, + _xre_font_surface_new, + _xre_font_surface_free, + _xre_font_surface_draw); + evas_common_font_draw(im, context, font, x, y, text); + evas_common_draw_context_font_ext_set(context, + NULL, + NULL, + NULL, + NULL); + evas_common_cpu_end_opt(); + + evas_cache_image_drop(&im->cache_entry); } /* module advertising code */ =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine_font.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- evas_engine_font.c 7 Apr 2008 23:07:23 -0000 1.4 +++ evas_engine_font.c 12 Apr 2008 00:32:28 -0000 1.5 @@ -162,8 +162,8 @@ fs = fg->ext_dat; if (!fs || !fs->xinf || !dc || !dc->col.col) return; - if (!surface || !surface->image || !surface->image->data) return; - target_surface = (Xrender_Surface *)(surface->image->data); + if (!surface || !surface->image.data) return; + target_surface = (Xrender_Surface *)(surface->image.data); a = (dc->col.col >> 24) & 0xff; r = (dc->col.col >> 16) & 0xff; g = (dc->col.col >> 8 ) & 0xff; =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine_gradient.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- evas_engine_gradient.c 16 Jul 2007 07:25:34 -0000 1.7 +++ evas_engine_gradient.c 12 Apr 2008 00:32:28 -0000 1.8 @@ -160,32 +160,26 @@ RGBA_Image *im; Ximage_Image *xim; - im = evas_common_image_new(); - if (!im) - { - _xr_render_surface_free(gr->surface); - gr->surface = NULL; - return; - } - im->image = evas_common_image_surface_new(im); - if (!im->image) + xim = _xr_image_new(gr->xinf, w, h, gr->surface->depth); + if (!xim) { - evas_common_image_delete(im); _xr_render_surface_free(gr->surface); gr->surface = NULL; return; } - xim = _xr_image_new(gr->xinf, w, h, gr->surface->depth); - if (!xim) + + im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(), + w, h, + (DATA32 *)xim->data, + 1, EVAS_COLORSPACE_ARGB8888); + if (!im) { - evas_common_image_delete(im); + /* FIXME: xim is leaking. */ _xr_render_surface_free(gr->surface); gr->surface = NULL; return; } - im->image->data = (DATA32 *)xim->data; - im->image->w = w; im->image->h = h; - im->image->no_free = 1; + dc->render_op = _EVAS_RENDER_FILL; dc->clip.use = 0; evas_common_gradient_draw(im, dc, 0, 0, w, h, gr->grad); @@ -196,7 +190,7 @@ (xim->xim->byte_order == MSBFirst) #endif { - DATA32 *p = im->image->data, *pe = p + (w * h); + DATA32 *p = im->image.data, *pe = p + (w * h); while (p < pe) { *p = (*p << 24) + ((*p << 8) & 0xff0000) + ((*p >> 8) & 0xff00) + (*p >> 24); @@ -204,7 +198,7 @@ } } _xr_image_put(xim, gr->surface->draw, 0, 0, w, h); - evas_common_image_delete(im); + evas_cache_image_drop(&im->cache_entry); dc->render_op = op; dc->clip.use = cuse; } =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine_image.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- evas_engine_image.c 7 Apr 2008 23:07:23 -0000 1.14 +++ evas_engine_image.c 12 Apr 2008 00:32:28 -0000 1.15 @@ -106,8 +106,8 @@ im->fkey = strdup(buf); im->file = evas_stringshare_add(file); if (key) im->key = evas_stringshare_add(key); - im->w = im->im->image->w; - im->h = im->im->image->h; + im->w = im->im->cache_entry.w; + im->h = im->im->cache_entry.h; im->references = 1; if (lo) im->load_opts = *lo; if (im->im->info.comment) im->comment = evas_stringshare_add(im->im->info.comment); @@ -235,7 +235,7 @@ if (im->file) evas_stringshare_del(im->file); if (im->key) evas_stringshare_del(im->key); if (im->fkey) free(im->fkey); - if (im->im) evas_cache_image_drop(im->im); + if (im->im) evas_cache_image_drop(&im->im->cache_entry); 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); @@ -301,8 +301,8 @@ im->im = evas_common_load_image_from_file(im->file, im->key, &(im->load_opts)); if (im->im) { - evas_common_load_image_data_from_file(im->im); - data = im->im->image->data; + evas_cache_image_load_data(&im->im->cache_entry); + data = im->im->image.data; } } if (!data) return NULL; @@ -334,7 +334,7 @@ } else if (im->im) { - evas_cache_image_drop(im->im); + evas_cache_image_drop(&im->im->cache_entry); im->im = NULL; if (im->free_data) { @@ -360,7 +360,7 @@ } if (im->im) { - evas_cache_image_drop(im->im); + evas_cache_image_drop(&im->im->cache_entry); im->im = NULL; } if (!im->cs.no_free) @@ -391,8 +391,8 @@ if (!im->im) im->im = evas_common_load_image_from_file(im->file, im->key, &(im->load_opts)); if (im->im) { - evas_common_load_image_data_from_file(im->im); - data = im->im->image->data; + evas_cache_image_load_data(&im->im->cache_entry); + data = im->im->image.data; } } return data; @@ -420,8 +420,8 @@ case EVAS_COLORSPACE_ARGB8888: if (im->im) { - if (data == im->im->image->data) return; - evas_cache_image_drop(im->im); + if (data == im->im->image.data) return; + evas_cache_image_drop(&im->im->cache_entry); im->im = NULL; } if (im->cs.data == data) return; @@ -519,7 +519,7 @@ { if (im->im) { - if (im->im->cs.space != EVAS_COLORSPACE_ARGB8888) return 0; + if (im->im->cache_entry.space != EVAS_COLORSPACE_ARGB8888) return 0; } return im->alpha; } @@ -559,8 +559,8 @@ if (!im->im) im->im = evas_common_load_image_from_file(im->file, im->key, &(im->load_opts)); if (im->im) { - evas_common_load_image_data_from_file(im->im); - data = im->im->image->data; + evas_cache_image_load_data(&im->im->cache_entry); + data = im->im->image.data; } } if (!data) @@ -656,7 +656,7 @@ im->w + 2, 1); if ((im->im) && (!im->dirty)) { - evas_cache_image_drop(im->im); + evas_cache_image_drop(&im->im->cache_entry); im->im = NULL; } if (tdata) free(tdata); ------------------------------------------------------------------------- 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