return 255;
}
- static inline void *evas_hash_find(const Eina_Hash *hash, const void *key)
- {
- if (!hash) return NULL;
- return eina_hash_find(hash, key);
- }
-
- static inline void *evas_hash_modify(Eina_Hash *hash, const void *key, const void *data)
- {
- if (!hash) return NULL;
- return eina_hash_modify(hash, key, data);
- }
- static inline void evas_hash_free(Eina_Hash *hash)
- {
- if (!hash) return ;
- eina_hash_free(hash);
- }
-
- static inline void evas_hash_foreach(const Eina_Hash *hash, Eina_Hash_Foreach cb, const void *fdata)
- {
- if (!hash) return;
- eina_hash_foreach(hash, cb, fdata);
- }
-
+ #define evas_hash_find eina_hash_find
+ #define evas_hash_modify eina_hash_modify
+ #define evas_hash_free eina_hash_free
+ #define evas_hash_foreach eina_hash_foreach
#define evas_hash_alloc_error eina_error_get
/*
Eina_Inlist *lru;
Eina_Inlist *lru_nodata;
- Evas_Hash *inactiv;
- Evas_Hash *activ;
+ Eina_Hash *inactiv;
+ Eina_Hash *activ;
void *data;
int usage;
{
Evas_Cache_Engine_Image_Func func;
- Eina_Inlist* dirty;
+ Eina_Inlist* dirty;
- Evas_Hash* activ;
- Evas_Hash* inactiv;
- Eina_Inlist* lru;
+ Eina_Hash* activ;
+ Eina_Hash* inactiv;
+ Eina_Inlist* lru;
Evas_Cache_Image* parent;
Evas_Cache_Engine_Image* brother;
eim->flags.cached = 1;
eim->flags.activ = 1;
eim->flags.dirty = 0;
- cache->activ = evas_hash_add(cache->activ, key, eim);
+ eina_hash_add(cache->activ, key, eim);
}
static void
eim->flags.cached = 1;
eim->flags.dirty = 0;
eim->flags.activ = 0;
- cache->inactiv = evas_hash_add(cache->inactiv, key, eim);
+ eina_hash_add(cache->inactiv, key, eim);
cache->lru = eina_inlist_prepend(cache->lru, EINA_INLIST_GET(eim));
cache->usage += cache->func.mem_size_get(eim);
}
else
if (eim->flags.activ)
{
- cache->activ = evas_hash_del(cache->activ, eim->cache_key, eim);
+ eina_hash_del(cache->activ, eim->cache_key, eim);
}
else
{
cache->usage -= cache->func.mem_size_get(eim);
- cache->inactiv = evas_hash_del(cache->inactiv, eim->cache_key, eim);
+ eina_hash_del(cache->inactiv, eim->cache_key, eim);
cache->lru = eina_inlist_remove(cache->lru, EINA_INLIST_GET(eim));
}
eim->flags.cached = 0;
new->dirty = NULL;
new->lru = NULL;
- new->activ = NULL;
- new->inactiv = NULL;
+ new->activ = eina_hash_string_superfast_new(NULL);
+ new->inactiv = eina_hash_string_superfast_new(NULL);
new->parent = parent;
parent->references++;
}
static Evas_Bool
-_evas_cache_engine_image_free_cb(__UNUSED__ const Evas_Hash *hash, __UNUSED__ const void *key, void *data, void *fdata)
+_evas_cache_engine_image_free_cb(__UNUSED__ const Eina_Hash *hash, __UNUSED__ const void *key, void *data, void *fdata)
{
Eina_List **delete_list = fdata;
if (cache->func.debug) cache->func.debug("shutdown-engine", NULL);
- evas_hash_foreach(cache->inactiv, _evas_cache_engine_image_free_cb, &delete_list);
- evas_hash_foreach(cache->activ, _evas_cache_engine_image_free_cb, &delete_list);
+ eina_hash_foreach(cache->inactiv, _evas_cache_engine_image_free_cb, &delete_list);
+ eina_hash_foreach(cache->activ, _evas_cache_engine_image_free_cb, &delete_list);
while (delete_list)
{
delete_list = eina_list_remove_list(delete_list, delete_list);
}
- evas_hash_free(cache->inactiv);
- evas_hash_free(cache->activ);
+ eina_hash_free(cache->inactiv);
+ eina_hash_free(cache->activ);
/* This is mad, I am about to destroy image still alive, but we need to prevent leak. */
while (cache->dirty)
if (!ekey)
goto on_error;
- eim = evas_hash_find(cache->activ, ekey);
+ eim = eina_hash_find(cache->activ, ekey);
if (eim)
{
evas_cache_image_drop(im);
goto on_ok;
}
- eim = evas_hash_find(cache->inactiv, ekey);
+ eim = eina_hash_find(cache->inactiv, ekey);
if (eim)
{
_evas_cache_engine_image_remove_activ(cache, eim);
im->flags.activ = 1;
im->flags.lru_nodata = 0;
im->flags.dirty = 0;
- cache->activ = evas_hash_direct_add(cache->activ, key, im);
+ eina_hash_direct_add(cache->activ, key, im);
}
else
{
im->flags.activ = 0;
im->flags.dirty = 0;
im->flags.cached = 1;
- cache->inactiv = evas_hash_direct_add(cache->inactiv, key, im);
+ eina_hash_direct_add(cache->inactiv, key, im);
cache->lru = eina_inlist_prepend(cache->lru, EINA_INLIST_GET(im));
cache->usage += cache->func.mem_size_get(im);
}
{
if (ie->flags.activ)
{
- cache->activ = evas_hash_del(cache->activ, ie->cache_key, ie);
+ eina_hash_del(cache->activ, ie->cache_key, ie);
_evas_cache_image_remove_lru_nodata(cache, ie);
}
else
}
else
{
- cache->inactiv = evas_hash_del(cache->inactiv, ie->cache_key, ie);
+ eina_hash_del(cache->inactiv, ie->cache_key, ie);
cache->lru = eina_inlist_remove(cache->lru, EINA_INLIST_GET(ie));
cache->usage -= cache->func.mem_size_get(ie);
}
new->dirty = NULL;
new->lru = NULL;
new->lru_nodata = NULL;
- new->inactiv = NULL;
- new->activ = NULL;
+ new->inactiv = eina_hash_string_superfast_new(NULL);
+ new->activ = eina_hash_string_superfast_new(NULL);
new->references = 1;
}
static Evas_Bool
-_evas_cache_image_free_cb(__UNUSED__ const Evas_Hash *hash, __UNUSED__ const void *key, void *data, void *fdata)
+_evas_cache_image_free_cb(__UNUSED__ const Eina_Hash *hash, __UNUSED__ const void *key, void *data, void *fdata)
{
Eina_List **delete_list = fdata;
_evas_cache_image_entry_delete(cache, im);
}
- evas_hash_foreach(cache->activ, _evas_cache_image_free_cb, &delete_list);
+ eina_hash_foreach(cache->activ, _evas_cache_image_free_cb, &delete_list);
while (delete_list)
{
delete_list = eina_list_remove_list(delete_list, delete_list);
}
- evas_hash_free(cache->activ);
- evas_hash_free(cache->inactiv);
+ eina_hash_free(cache->activ);
+ eina_hash_free(cache->inactiv);
free(cache);
}
hkey[size] = '\0';
- im = evas_hash_find(cache->activ, hkey);
+ im = eina_hash_find(cache->activ, hkey);
if (im)
{
time_t t;
_evas_cache_image_make_dirty(cache, im);
}
- im = evas_hash_find(cache->inactiv, hkey);
+ im = eina_hash_find(cache->inactiv, hkey);
if (im)
{
int ok;
#endif
/* font dir cache */
-static Evas_Hash *font_dirs = NULL;
+static Eina_Hash *font_dirs = NULL;
static Eina_List *fonts_cache = NULL;
static Eina_List *fonts_zero = NULL;
};
/* private methods for font dir cache */
-static Evas_Bool font_cache_dir_free(const Evas_Hash *hash, const void *key, void *data, void *fdata);
+static Evas_Bool font_cache_dir_free(const Eina_Hash *hash, const void *key, void *data, void *fdata);
static Evas_Font_Dir *object_text_font_cache_dir_update(char *dir, Evas_Font_Dir *fd);
static Evas_Font *object_text_font_cache_font_find_x(Evas_Font_Dir *fd, char *font);
static Evas_Font *object_text_font_cache_font_find_file(Evas_Font_Dir *fd, char *font);
{
if (!font_dirs) return;
- evas_hash_foreach(font_dirs, font_cache_dir_free, NULL);
- evas_hash_free(font_dirs);
+ eina_hash_foreach(font_dirs, font_cache_dir_free, NULL);
+ eina_hash_free(font_dirs);
font_dirs = NULL;
}
const char *
evas_font_dir_cache_find(char *dir, char *font)
{
- Evas_Font_Dir *fd;
+ Evas_Font_Dir *fd = NULL;
- fd = evas_hash_find(font_dirs, dir);
+ if (!font_dirs) font_dirs = eina_hash_string_superfast_new(NULL);
+ else fd = eina_hash_find(font_dirs, dir);
fd = object_text_font_cache_dir_update(dir, fd);
if (fd)
{
if (!evas->font_path)
return available;
+ if (!font_dirs) font_dirs = eina_hash_string_superfast_new(NULL);
+
EINA_LIST_FOREACH(evas->font_path, l, dir)
{
Evas_Font_Dir *fd;
- fd = evas_hash_find(font_dirs, dir);
+ fd = eina_hash_find(font_dirs, dir);
fd = object_text_font_cache_dir_update(dir, fd);
if (fd && fd->aliases)
{
/* private stuff */
static Eina_Bool
-font_cache_dir_free(const Evas_Hash *hash, const void *key, void *data, void *fdata)
+font_cache_dir_free(const Eina_Hash *hash, const void *key, void *data, void *fdata)
{
object_text_font_cache_dir_del((char *) key, data);
return 1;
if (mt != fd->dir_mod_time)
{
object_text_font_cache_dir_del(dir, fd);
- font_dirs = evas_hash_del(font_dirs, dir, fd);
+ eina_hash_del(font_dirs, dir, fd);
}
else
{
if (mt != fd->fonts_dir_mod_time)
{
object_text_font_cache_dir_del(dir, fd);
- font_dirs = evas_hash_del(font_dirs, dir, fd);
+ eina_hash_del(font_dirs, dir, fd);
}
else
{
if (mt != fd->fonts_alias_mod_time)
{
object_text_font_cache_dir_del(dir, fd);
- font_dirs = evas_hash_del(font_dirs, dir, fd);
+ eina_hash_del(font_dirs, dir, fd);
}
else
return fd;
{
Evas_Font *fn;
- fn = evas_hash_find(fd->lookup, font);
+ fn = eina_hash_find(fd->lookup, font);
if (fn) return fn;
fn = object_text_font_cache_font_find_alias(fd, font);
if (!fn) fn = object_text_font_cache_font_find_x(fd, font);
if (!fn) fn = object_text_font_cache_font_find_file(fd, font);
if (!fn) return NULL;
- fd->lookup = evas_hash_add(fd->lookup, font, fn);
+ eina_hash_add(fd->lookup, font, fn);
return fn;
}
Evas_Font_Dir *fd;
char *tmp, *tmp2;
Eina_List *fdir;
+ Evas_Font *fn;
fd = calloc(1, sizeof(Evas_Font_Dir));
if (!fd) return NULL;
- font_dirs = evas_hash_add(font_dirs, dir, fd);
+ fd->lookup = eina_hash_string_superfast_new(NULL);
+
+ eina_hash_add(font_dirs, dir, fd);
/* READ fonts.alias, fonts.dir and directory listing */
num = evas_object_text_font_string_parse((char *)fdef, font_prop);
if (num == 14)
{
- Evas_Font *fn;
-
fn = calloc(1, sizeof(Evas_Font));
if (fn)
{
tmp = evas_file_path_join(dir, fdir->data);
if (tmp)
{
- Evas_Font *fn;
-
fn = calloc(1, sizeof(Evas_Font));
if (fn)
{
static void
object_text_font_cache_dir_del(char *dir, Evas_Font_Dir *fd)
{
- if (fd->lookup) evas_hash_free(fd->lookup);
+ if (fd->lookup) eina_hash_free(fd->lookup);
while (fd->fonts)
{
Evas_Font *fn;
e->viewport.w = 1;
e->viewport.h = 1;
e->hinting = EVAS_FONT_HINTING_BYTECODE;
+ e->name_hash = eina_hash_string_superfast_new(NULL);
eina_array_step_set(&e->delete_objects, 16);
eina_array_step_set(&e->active_objects, 16);
evas_font_path_clear(e);
e->pointer.object.in = eina_list_free(e->pointer.object.in);
- if (e->name_hash) evas_hash_free(e->name_hash);
+ if (e->name_hash) eina_hash_free(e->name_hash);
+ e->name_hash = NULL;
while (e->damages)
{
MAGIC_CHECK_END();
if (obj->name)
{
- obj->layer->evas->name_hash = evas_hash_del(obj->layer->evas->name_hash, obj->name, obj);
+ eina_hash_del(obj->layer->evas->name_hash, obj->name, obj);
free(obj->name);
}
if (!name) obj->name = NULL;
else
{
obj->name = strdup(name);
- obj->layer->evas->name_hash = evas_hash_add(obj->layer->evas->name_hash, obj->name, obj);
+ eina_hash_add(obj->layer->evas->name_hash, obj->name, obj);
}
}
return NULL;
MAGIC_CHECK_END();
if (!name) return NULL;
- return (Evas_Object *)evas_hash_find(e->name_hash, name);
+ return (Evas_Object *)eina_hash_find(e->name_hash, name);
}
/**
evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt index)
{
RGBA_Font_Glyph *fg;
- char key[6];
FT_UInt hindex;
FT_Error error;
const FT_Int32 hintflags[3] =
hindex = index + (fi->hinting * 500000000);
- key[0] = ((hindex ) & 0x7f) + 1;
- key[1] = ((hindex >> 7 ) & 0x7f) + 1;
- key[2] = ((hindex >> 14 ) & 0x7f) + 1;
- key[3] = ((hindex >> 21 ) & 0x7f) + 1;
- key[4] = ((hindex >> 28 ) & 0x0f) + 1;
- key[5] = 0;
-
- fg = evas_hash_find(fi->glyphs, key);
+ fg = eina_hash_find(fi->glyphs, &hindex);
if (fg) return fg;
// error = FT_Load_Glyph(fi->src->ft.face, index, FT_LOAD_NO_BITMAP);
}
fg->glyph_out = (FT_BitmapGlyph)fg->glyph;
- fi->glyphs = evas_hash_add(fi->glyphs, key, fg);
+ eina_hash_add(fi->glyphs, &hindex, fg);
return fg;
}
static Eina_Inlist * fonts_src = NULL;
static Eina_Inlist * fonts = NULL;
-static Evas_Bool font_modify_cache_cb(const Evas_Hash *hash, const char *key, void *data, void *fdata);
-static Evas_Bool font_flush_free_glyph_cb(const Evas_Hash *hash, const char *key, void *data, void *fdata);
+static Evas_Bool font_modify_cache_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata);
+static Evas_Bool font_flush_free_glyph_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata);
EAPI RGBA_Font_Source *
evas_common_font_source_memory_load(const char *name, const void *data, int data_size)
evas_common_font_int_load_init(RGBA_Font_Int *fi)
{
fi->ft.size = NULL;
- fi->glyphs = NULL;
+ fi->glyphs = eina_hash_int32_new(NULL);
fi->usage = 0;
fi->references = 1;
fonts = eina_inlist_prepend(fonts, EINA_INLIST_GET(fi));
+
return fi;
}
evas_common_font_free(RGBA_Font *fn)
{
Eina_List *l;
+ RGBA_Font_Int *fi;
if (!fn)
return;
fn->references--;
if (fn->references > 0) return;
- for (l = fn->fonts; l; l = l->next)
+ EINA_LIST_FOREACH(fn->fonts, l, fi)
{
- RGBA_Font_Int *fi;
-
- fi = l->data;
fi->references--;
if (fi->references == 0)
{
evas_common_font_hinting_set(RGBA_Font *fn, Font_Hint_Flags hinting)
{
Eina_List *l;
+ RGBA_Font_Int *fi;
if (!fn)
return;
fn->hinting = hinting;
- for (l = fn->fonts; l; l = l->next)
- {
- RGBA_Font_Int *fi;
-
- fi = l->data;
- fi->hinting = fn->hinting;
- }
+ EINA_LIST_FOREACH(fn->fonts, l, fi)
+ fi->hinting = fn->hinting;
}
EAPI Evas_Bool
return fn;
}
-static Evas_Bool
-font_modify_cache_cb(const Evas_Hash *hash, const char *key, void *data, void *fdata)
+static Eina_Bool
+font_modify_cache_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
{
int *dir;
RGBA_Font_Glyph *fg;
{
int sz_hash = 0;
- if (fi->glyphs) sz_hash = evas_hash_size(fi->glyphs);
- evas_hash_foreach(fi->glyphs, font_modify_cache_cb, &dir);
+ if (fi->glyphs) sz_hash = eina_hash_population(fi->glyphs);
+ eina_hash_foreach(fi->glyphs, font_modify_cache_cb, &dir);
font_cache_usage += dir * (sizeof(RGBA_Font) + sz_hash +
sizeof(FT_FaceRec) + 16384); /* fudge values */
}
while (font_cache_usage > font_cache) evas_common_font_flush_last();
}
-static Evas_Bool
-font_flush_free_glyph_cb(const Evas_Hash *hash, const char *key, void *data, void *fdata)
+static Eina_Bool
+font_flush_free_glyph_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
{
RGBA_Font_Glyph *fg;
fonts = eina_inlist_remove(fonts, EINA_INLIST_GET(fi));
evas_common_font_int_modify_cache_by(fi, -1);
- evas_hash_foreach(fi->glyphs, font_flush_free_glyph_cb, NULL);
- evas_hash_free(fi->glyphs);
+ eina_hash_foreach(fi->glyphs, font_flush_free_glyph_cb, NULL);
+ eina_hash_free(fi->glyphs);
evas_common_font_source_free(fi->src);
FT_Size size;
} ft;
- Evas_Hash *glyphs;
+ Eina_Hash *glyphs;
int usage;
Font_Hint_Flags hinting;
Evas_Layer *layers;
- Evas_Hash *name_hash;
+ Eina_Hash *name_hash;
int output_validity;
struct _Evas_Font_Dir
{
- Evas_Hash *lookup;
+ Eina_Hash *lookup;
Eina_List *fonts;
Eina_List *aliases;
DATA64 dir_mod_time;
#include "evas_engine.h"
#include "Evas_Engine_XRender_X11.h"
-static Evas_Hash *_xr_fg_pool = NULL;
+static Eina_Hash *_xr_fg_pool = NULL;
XR_Font_Surface *
_xre_font_surface_new(Ximage_Info *xinf, RGBA_Font_Glyph *fg)
-{
+{
XR_Font_Surface *fs;
DATA8 *data;
int w, h, j;
XRenderPictureAttributes att;
XRenderPictFormat *fmt;
Ximage_Image *xim;
- Evas_Hash *pool;
+ Eina_Hash *pool;
char buf[256], buf2[256];
-
+
data = fg->glyph_out->bitmap.buffer;
w = fg->glyph_out->bitmap.width;
h = fg->glyph_out->bitmap.rows;
if ((fs->xinf->disp == xinf->disp) && (fs->xinf->root == xinf->root))
return fs;
snprintf(buf, sizeof(buf), "@%p@/@%lx@", fs->xinf->disp, fs->xinf->root);
- pool = evas_hash_find(_xr_fg_pool, buf);
+ pool = eina_hash_find(_xr_fg_pool, buf);
if (pool)
{
snprintf(buf, sizeof(buf), "%p", fg);
- fs = evas_hash_find(pool, buf);
+ fs = eina_hash_find(pool, buf);
if (fs) return fs;
}
}
fs->xinf->references++;
fs->w = w;
fs->h = h;
-
+
snprintf(buf, sizeof(buf), "@%p@/@%lx@", fs->xinf->disp, fs->xinf->root);
- pool = evas_hash_find(_xr_fg_pool, buf);
+ pool = eina_hash_find(_xr_fg_pool, buf);
+ if (!pool) pool = eina_hash_string_superfast_new(NULL);
snprintf(buf2, sizeof(buf2), "%p", fg);
- pool = evas_hash_add(pool, buf2, fs);
- _xr_fg_pool = evas_hash_add(_xr_fg_pool, buf, pool);
+ eina_hash_add(pool, buf2, fs);
+ if (!_xr_fg_pool) _xr_fg_pool = eina_hash_string_superfast_new(NULL);
+ eina_hash_add(_xr_fg_pool, buf, pool);
/* FIXME: maybe use fmt4? */
fmt = xinf->fmt8;
att.dither = 0;
att.component_alpha = 0;
att.repeat = 0;
- fs->pic = XRenderCreatePicture(xinf->disp, fs->draw,fmt,
+ fs->pic = XRenderCreatePicture(xinf->disp, fs->draw,fmt,
CPRepeat | CPDither | CPComponentAlpha, &att);
-
+
/* FIXME: handle if fmt->depth != 8 */
xim = _xr_image_new(fs->xinf, w, h,fmt->depth);
if ((fg->glyph_out->bitmap.num_grays == 256) &&
}
static Evas_Bool
-_xre_font_pool_cb(const Evas_Hash *hash, const char *key, void *data, void *fdata)
+_xre_font_pool_cb(const Eina_Hash *hash, const char *key, void *data, void *fdata)
{
- Evas_Hash *pool;
+ Eina_Hash *pool;
XR_Font_Surface *fs;
char buf[256];
-
+
fs = fdata;
pool = data;
snprintf(buf, sizeof(buf), "@%p@/@%lx@", fs->xinf->disp, fs->xinf->root);
- pool = evas_hash_del(pool, buf, fs);
- hash = evas_hash_modify(hash, key, pool);
+ eina_hash_del(pool, buf, fs);
+ if (!hash) hash = eina_hash_string_superfast_new(NULL);
+ eina_hash_modify(hash, key, pool);
return 1;
}
_xre_font_surface_free(XR_Font_Surface *fs)
{
if (!fs) return;
- evas_hash_foreach(_xr_fg_pool, _xre_font_pool_cb, fs);
+ eina_hash_foreach(_xr_fg_pool, _xre_font_pool_cb, fs);
XFreePixmap(fs->xinf->disp, fs->draw);
XRenderFreePicture(fs->xinf->disp, fs->pic);
_xr_image_info_free(fs->xinf);
#include "evas_engine.h"
#include "Evas_Engine_XRender_X11.h"
-static Evas_Hash *_xr_image_hash = NULL;
+static Eina_Hash *_xr_image_hash = NULL;
static int _xr_image_cache_size = 0;
static int _xr_image_cache_usage = 0;
static Eina_List *_xr_image_cache = NULL;
-static Evas_Hash *_xr_image_dirty_hash = NULL;
+static Eina_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);
+ if (!_xr_image_dirty_hash) _xr_image_dirty_hash = eina_hash_string_superfast_new(NULL);
+ eina_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);
+ eina_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);
+ return eina_hash_find(_xr_image_dirty_hash, buf);
}
static XR_Image *
__xre_image_find(char *fkey)
{
XR_Image *im;
-
- im = evas_hash_find(_xr_image_hash, fkey);
+
+ im = eina_hash_find(_xr_image_hash, fkey);
if (!im)
{
Eina_List *l;
-
+
for (l = _xr_image_cache; l; l = l->next)
{
im = l->data;
if (!strcmp(im->fkey, fkey))
{
_xr_image_cache = eina_list_remove_list(_xr_image_cache, l);
- _xr_image_hash = evas_hash_add(_xr_image_hash, im->fkey, im);
+ if (!_xr_image_hash) _xr_image_hash = eina_hash_string_superfast_new(NULL);
+ eina_hash_add(_xr_image_hash, im->fkey, im);
_xr_image_cache_usage -= (im->w * im->h * 4);
break;
}
{
return im;
}
-
+
im = calloc(1, sizeof(XR_Image));
if (!im) return NULL;
im->im = evas_common_load_image_from_file(file, key, lo);
if (im->im->info.comment) im->comment = eina_stringshare_add(im->im->info.comment);
// if (im->im->info.format == 1) im->format = eina_stringshare_add("png");
if (im->im->cache_entry.flags.alpha) im->alpha = 1;
- _xr_image_hash = evas_hash_direct_add(_xr_image_hash, im->fkey, im);
+ if (!_xr_image_hash) _xr_image_hash = eina_hash_string_superfast_new(NULL);
+ eina_hash_direct_add(_xr_image_hash, im->fkey, im);
return im;
}
if (data)
{
Gfx_Func_Copy func;
-
+
func = evas_common_draw_func_copy_get(w * h, 0);
if (func) func(data, im->data, w * h);
evas_common_cpu_end_opt();
if (!im->dirty)
{
if (im->fkey)
- _xr_image_hash = evas_hash_del(_xr_image_hash, im->fkey, im);
+ eina_hash_del(_xr_image_hash, im->fkey, im);
_xr_image_cache = eina_list_prepend(_xr_image_cache, im);
_xr_image_cache_usage += (im->w * im->h * 4);
_xre_image_cache_set(_xr_image_cache_size);
{
if (im->dirty) return;
if (im->fkey)
- _xr_image_hash = evas_hash_del(_xr_image_hash, im->fkey, im);
+ eina_hash_del(_xr_image_hash, im->fkey, im);
im->dirty = 1;
__xre_image_dirty_hash_add(im);
}
if (!im->dirty)
{
if (im->fkey)
- _xr_image_hash = evas_hash_del(_xr_image_hash, im->fkey, im);
+ eina_hash_del(_xr_image_hash, im->fkey, im);
im->dirty = 1;
}
if (im->updates)
#include "evas_engine.h"
#include "Evas_Engine_XRender_Xcb.h"
-static Evas_Hash *_xr_fg_pool = NULL;
+static Eina_Hash *_xr_fg_pool = NULL;
XR_Font_Surface *
_xre_font_surface_new(Xcb_Image_Info *xcbinf, RGBA_Font_Glyph *fg)
-{
+{
char buf[256];
char buf2[256];
XR_Font_Surface *fs;
DATA8 *data;
int w, h, j;
Xcb_Image_Image *xcim;
- Evas_Hash *pool;
+ Eina_Hash *pool;
uint32_t mask;
uint32_t values[3];
-
+
data = fg->glyph_out->bitmap.buffer;
w = fg->glyph_out->bitmap.width;
h = fg->glyph_out->bitmap.rows;
(fs->xcbinf->root == xcbinf->root))
return fs;
snprintf(buf, sizeof(buf), "@%p@/@%x@", fs->xcbinf->conn, fs->xcbinf->root);
- pool = evas_hash_find(_xr_fg_pool, buf);
+ pool = eina_hash_find(_xr_fg_pool, buf);
if (pool)
{
snprintf(buf, sizeof(buf), "%p", fg);
- fs = evas_hash_find(pool, buf);
+ fs = eina_hash_find(pool, buf);
if (fs) return fs;
}
}
fs->xcbinf->references++;
fs->w = w;
fs->h = h;
-
+
snprintf(buf, sizeof(buf), "@%p@/@%x@", fs->xcbinf->conn, fs->xcbinf->root);
- pool = evas_hash_find(_xr_fg_pool, buf);
+ pool = eina_hash_find(_xr_fg_pool, buf);
+ if (!pool) pool = eina_hash_string_superfast_new(NULL);
snprintf(buf2, sizeof(buf2), "%p", fg);
- pool = evas_hash_add(pool, buf2, fs);
- _xr_fg_pool = evas_hash_add(_xr_fg_pool, buf, pool);
+ eina_hash_add(pool, buf2, fs);
+ if (!_xr_fg_pool) _xr_fg_pool = eina_hash_string_superfast_new(NULL);
+ eina_hash_add(_xr_fg_pool, buf, pool);
fs->draw = xcb_generate_id(xcbinf->conn);
xcb_create_pixmap(xcbinf->conn, xcbinf->fmt8->depth, fs->draw, xcbinf->root, w, h);
}
static Evas_Bool
-_xre_font_pool_cb(const Evas_Hash *hash, const char *key, void *data, void *fdata)
+_xre_font_pool_cb(const Eina_Hash *hash, const char *key, void *data, void *fdata)
{
char buf[256];
- Evas_Hash *pool;
+ Eina_Hash *pool;
XR_Font_Surface *fs;
-
+
fs = fdata;
pool = data;
snprintf(buf, sizeof(buf), "@%p@/@%x@", fs->xcbinf->conn, fs->xcbinf->root);
- pool = evas_hash_del(pool, buf, fs);
- hash = evas_hash_modify(hash, key, pool);
+ eina_hash_del(pool, buf, fs);
+ if (!hash) hash = eina_hash_string_superfast_new(NULL);
+ eina_hash_modify(hash, key, pool);
return 1;
}
_xre_font_surface_free(XR_Font_Surface *fs)
{
if (!fs) return;
- evas_hash_foreach(_xr_fg_pool, _xre_font_pool_cb, fs);
+ eina_hash_foreach(_xr_fg_pool, _xre_font_pool_cb, fs);
xcb_free_pixmap(fs->xcbinf->conn, fs->draw);
xcb_render_free_picture(fs->xcbinf->conn, fs->pic);
_xr_image_info_free(fs->xcbinf);
#include "evas_engine.h"
#include "Evas_Engine_XRender_Xcb.h"
-static Evas_Hash *_xr_image_hash = NULL;
+static Eina_Hash *_xr_image_hash = NULL;
static int _xr_image_cache_size = 0;
static int _xr_image_cache_usage = 0;
static Eina_List *_xr_image_cache = NULL;
-static Evas_Hash *_xr_image_dirty_hash = NULL;
+static Eina_Hash *_xr_image_dirty_hash = NULL;
static void
__xre_image_dirty_hash_add(XR_Image *im)
if (!im->data) return;
snprintf(buf, sizeof(buf), "%p", im->data);
- _xr_image_dirty_hash = evas_hash_add(_xr_image_dirty_hash, buf, im);
+ if (!_xr_image_dirty_hash) _xr_image_dirty_hash = eina_hash_string_superfast_new(NULL);
+ eina_hash_add(_xr_image_dirty_hash, buf, im);
}
static void
if (!im->data) return;
snprintf(buf, sizeof(buf), "%p", im->data);
- _xr_image_dirty_hash = evas_hash_del(_xr_image_dirty_hash, buf, im);
+ eina_hash_del(_xr_image_dirty_hash, buf, im);
}
static XR_Image *
char buf[64];
snprintf(buf, sizeof(buf), "%p", data);
- return evas_hash_find(_xr_image_dirty_hash, buf);
+ return eina_hash_find(_xr_image_dirty_hash, buf);
}
static XR_Image *
{
XR_Image *im;
- im = evas_hash_find(_xr_image_hash, fkey);
+ im = eina_hash_find(_xr_image_hash, fkey);
if (!im)
{
Eina_List *l;
if (!strcmp(im->fkey, fkey))
{
_xr_image_cache = eina_list_remove_list(_xr_image_cache, l);
- _xr_image_hash = evas_hash_add(_xr_image_hash, im->fkey, im);
+ if (!_xr_image_hash) _xr_image_hash = eina_hash_string_superfast_new(NULL);
+ eina_hash_add(_xr_image_hash, im->fkey, im);
_xr_image_cache_usage -= (im->w * im->h * 4);
break;
}
if (im->im->info.comment) im->comment = (char *)eina_stringshare_add(im->im->info.comment);
/* if (im->im->info.format == 1) im->format = eina_stringshare_add("png"); */
if (im->im->cache_entry.flags.alpha) im->alpha = 1;
- _xr_image_hash = evas_hash_direct_add(_xr_image_hash, im->fkey, im);
+ if (!_xr_image_hash) _xr_image_hash = eina_hash_string_superfast_new(NULL);
+ _xr_image_hash = eina_hash_direct_add(_xr_image_hash, im->fkey, im);
return im;
}
if (!im->dirty)
{
if (im->fkey)
- _xr_image_hash = evas_hash_del(_xr_image_hash, im->fkey, im);
+ eina_hash_del(_xr_image_hash, im->fkey, im);
_xr_image_cache = eina_list_prepend(_xr_image_cache, im);
_xr_image_cache_usage += (im->w * im->h * 4);
_xre_image_cache_set(_xr_image_cache_size);
{
if (im->dirty) return;
if (im->fkey)
- _xr_image_hash = evas_hash_del(_xr_image_hash, im->fkey, im);
+ eina_hash_del(_xr_image_hash, im->fkey, im);
im->dirty = 1;
__xre_image_dirty_hash_add(im);
}
if (!im->dirty)
{
if (im->fkey)
- _xr_image_hash = evas_hash_del(_xr_image_hash, im->fkey, im);
+ eina_hash_del(_xr_image_hash, im->fkey, im);
im->dirty = 1;
}
if (im->updates)