forked from enlightenment/efl
As cache_key uses evas_stringshare, it should be const.
Don't free stringshare'd strings. Formatting. SVN revision: 31291
This commit is contained in:
parent
07c37865cf
commit
8ef049c3da
|
@ -5,7 +5,7 @@
|
||||||
#include "evas_private.h"
|
#include "evas_private.h"
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
evas_cache_engine_image_usage_get(Evas_Cache_Engine_Image* cache)
|
evas_cache_engine_image_usage_get(Evas_Cache_Engine_Image *cache)
|
||||||
{
|
{
|
||||||
assert(cache != NULL);
|
assert(cache != NULL);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ evas_cache_engine_image_usage_get(Evas_Cache_Engine_Image* cache)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
evas_cache_engine_image_get(Evas_Cache_Engine_Image* cache)
|
evas_cache_engine_image_get(Evas_Cache_Engine_Image *cache)
|
||||||
{
|
{
|
||||||
assert(cache != NULL);
|
assert(cache != NULL);
|
||||||
|
|
||||||
|
@ -21,17 +21,17 @@ evas_cache_engine_image_get(Evas_Cache_Engine_Image* cache)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_cache_engine_image_set(Evas_Cache_Engine_Image* cache, int limit)
|
evas_cache_engine_image_set(Evas_Cache_Engine_Image *cache, int limit)
|
||||||
{
|
{
|
||||||
assert(cache != NULL);
|
assert(cache != NULL);
|
||||||
|
|
||||||
cache->limit = limit;
|
cache->limit = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_Cache_Engine_Image*
|
EAPI Evas_Cache_Engine_Image *
|
||||||
evas_cache_engine_image_init(const Evas_Cache_Engine_Image_Func *cb, Evas_Cache_Image *parent)
|
evas_cache_engine_image_init(const Evas_Cache_Engine_Image_Func *cb, Evas_Cache_Image *parent)
|
||||||
{
|
{
|
||||||
Evas_Cache_Engine_Image* new;
|
Evas_Cache_Engine_Image *new;
|
||||||
|
|
||||||
new = malloc(sizeof (Evas_Cache_Engine_Image));
|
new = malloc(sizeof (Evas_Cache_Engine_Image));
|
||||||
if (!new)
|
if (!new)
|
||||||
|
@ -54,9 +54,9 @@ evas_cache_engine_image_init(const Evas_Cache_Engine_Image_Func *cb, Evas_Cache_
|
||||||
static Evas_Bool
|
static Evas_Bool
|
||||||
_evas_cache_engine_image_free_cb(Evas_Hash *hash, const char *key, void *data, void *fdata)
|
_evas_cache_engine_image_free_cb(Evas_Hash *hash, const char *key, void *data, void *fdata)
|
||||||
{
|
{
|
||||||
Evas_Cache_Engine_Image* cache = fdata;
|
Evas_Cache_Engine_Image *cache = fdata;
|
||||||
RGBA_Engine_Image* eim = data;
|
RGBA_Engine_Image *eim = data;
|
||||||
RGBA_Image* im;
|
RGBA_Image *im;
|
||||||
|
|
||||||
if (cache->func.debug)
|
if (cache->func.debug)
|
||||||
cache->func.debug("shutdown-engine-activ", eim);
|
cache->func.debug("shutdown-engine-activ", eim);
|
||||||
|
@ -73,17 +73,17 @@ _evas_cache_engine_image_free_cb(Evas_Hash *hash, const char *key, void *data, v
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image* cache)
|
evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image *cache)
|
||||||
{
|
{
|
||||||
RGBA_Engine_Image* eim;
|
RGBA_Engine_Image *eim;
|
||||||
RGBA_Image* im;
|
RGBA_Image *im;
|
||||||
|
|
||||||
assert(cache != NULL);
|
assert(cache != NULL);
|
||||||
|
|
||||||
/* This is mad, I am about to destroy image still alive, but we need to prevent leak. */
|
/* This is mad, I am about to destroy image still alive, but we need to prevent leak. */
|
||||||
while (cache->dirty)
|
while (cache->dirty)
|
||||||
{
|
{
|
||||||
eim = (RGBA_Engine_Image*) cache->dirty;
|
eim = (RGBA_Engine_Image *) cache->dirty;
|
||||||
im = eim->src;
|
im = eim->src;
|
||||||
|
|
||||||
cache->dirty = evas_object_list_remove(cache->dirty, eim);
|
cache->dirty = evas_object_list_remove(cache->dirty, eim);
|
||||||
|
@ -99,13 +99,13 @@ evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image* cache)
|
||||||
evas_hash_free(cache->activ);
|
evas_hash_free(cache->activ);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Engine_Image*
|
EAPI RGBA_Engine_Image *
|
||||||
evas_cache_engine_image_request(Evas_Cache_Engine_Image *cache, const char *file, const char *key,
|
evas_cache_engine_image_request(Evas_Cache_Engine_Image *cache, const char *file, const char *key,
|
||||||
RGBA_Image_Loadopts *lo, void *data, int *error)
|
RGBA_Image_Loadopts *lo, void *data, int *error)
|
||||||
{
|
{
|
||||||
RGBA_Engine_Image* eim;
|
RGBA_Engine_Image *eim;
|
||||||
RGBA_Image* im;
|
RGBA_Image *im;
|
||||||
const char* ekey;
|
const char *ekey;
|
||||||
|
|
||||||
assert(cache != NULL);
|
assert(cache != NULL);
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ evas_cache_engine_image_request(Evas_Cache_Engine_Image *cache, const char *file
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_evas_cache_engine_image_free(Evas_Cache_Engine_Image* cache, RGBA_Engine_Image *eim)
|
_evas_cache_engine_image_free(Evas_Cache_Engine_Image *cache, RGBA_Engine_Image *eim)
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ _evas_cache_engine_image_free(Evas_Cache_Engine_Image* cache, RGBA_Engine_Image
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_cache_engine_image_drop(RGBA_Engine_Image *eim)
|
evas_cache_engine_image_drop(RGBA_Engine_Image *eim)
|
||||||
{
|
{
|
||||||
Evas_Cache_Engine_Image* cache;
|
Evas_Cache_Engine_Image *cache;
|
||||||
|
|
||||||
assert(eim);
|
assert(eim);
|
||||||
assert(eim->cache);
|
assert(eim->cache);
|
||||||
|
@ -205,13 +205,13 @@ evas_cache_engine_image_drop(RGBA_Engine_Image *eim)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Engine_Image*
|
EAPI RGBA_Engine_Image *
|
||||||
evas_cache_engine_image_dirty(RGBA_Engine_Image *eim, int x, int y, int w, int h)
|
evas_cache_engine_image_dirty(RGBA_Engine_Image *eim, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
RGBA_Engine_Image* eim_dirty = eim;
|
RGBA_Engine_Image *eim_dirty = eim;
|
||||||
RGBA_Image* im;
|
RGBA_Image *im;
|
||||||
RGBA_Image* im_dirty;
|
RGBA_Image *im_dirty;
|
||||||
Evas_Cache_Engine_Image* cache;
|
Evas_Cache_Engine_Image *cache;
|
||||||
|
|
||||||
assert(eim);
|
assert(eim);
|
||||||
assert(eim->cache);
|
assert(eim->cache);
|
||||||
|
@ -227,7 +227,7 @@ evas_cache_engine_image_dirty(RGBA_Engine_Image *eim, int x, int y, int w, int h
|
||||||
{
|
{
|
||||||
if (eim->references == 1)
|
if (eim->references == 1)
|
||||||
{
|
{
|
||||||
const char* hkey;
|
const char *hkey;
|
||||||
|
|
||||||
hkey = eim->cache_key;
|
hkey = eim->cache_key;
|
||||||
cache->activ = evas_hash_del(cache->activ, hkey, eim);
|
cache->activ = evas_hash_del(cache->activ, hkey, eim);
|
||||||
|
@ -289,8 +289,8 @@ evas_cache_engine_image_dirty(RGBA_Engine_Image *eim, int x, int y, int w, int h
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RGBA_Engine_Image*
|
static RGBA_Engine_Image *
|
||||||
_evas_cache_engine_image_push_dirty(Evas_Cache_Engine_Image *cache, RGBA_Image *im, void* engine_data)
|
_evas_cache_engine_image_push_dirty(Evas_Cache_Engine_Image *cache, RGBA_Image *im, void *engine_data)
|
||||||
{
|
{
|
||||||
RGBA_Engine_Image *eim;
|
RGBA_Engine_Image *eim;
|
||||||
int error;
|
int error;
|
||||||
|
@ -323,8 +323,8 @@ _evas_cache_engine_image_push_dirty(Evas_Cache_Engine_Image *cache, RGBA_Image *
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Engine_Image*
|
EAPI RGBA_Engine_Image *
|
||||||
evas_cache_engine_image_copied_data(Evas_Cache_Engine_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace, void* engine_data)
|
evas_cache_engine_image_copied_data(Evas_Cache_Engine_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace, void *engine_data)
|
||||||
{
|
{
|
||||||
RGBA_Image *im;
|
RGBA_Image *im;
|
||||||
|
|
||||||
|
@ -335,8 +335,8 @@ evas_cache_engine_image_copied_data(Evas_Cache_Engine_Image *cache, int w, int h
|
||||||
return _evas_cache_engine_image_push_dirty(cache, im, engine_data);
|
return _evas_cache_engine_image_push_dirty(cache, im, engine_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Engine_Image*
|
EAPI RGBA_Engine_Image *
|
||||||
evas_cache_engine_image_data(Evas_Cache_Engine_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace, void* engine_data)
|
evas_cache_engine_image_data(Evas_Cache_Engine_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace, void *engine_data)
|
||||||
{
|
{
|
||||||
RGBA_Image *im;
|
RGBA_Image *im;
|
||||||
|
|
||||||
|
@ -347,12 +347,12 @@ evas_cache_engine_image_data(Evas_Cache_Engine_Image *cache, int w, int h, DATA3
|
||||||
return _evas_cache_engine_image_push_dirty(cache, im, engine_data);
|
return _evas_cache_engine_image_push_dirty(cache, im, engine_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Engine_Image*
|
EAPI RGBA_Engine_Image *
|
||||||
evas_cache_engine_image_size_set(RGBA_Engine_Image *eim, int w, int h)
|
evas_cache_engine_image_size_set(RGBA_Engine_Image *eim, int w, int h)
|
||||||
{
|
{
|
||||||
Evas_Cache_Engine_Image* cache;
|
Evas_Cache_Engine_Image *cache;
|
||||||
RGBA_Engine_Image* new;
|
RGBA_Engine_Image *new;
|
||||||
RGBA_Image* im;
|
RGBA_Image *im;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
assert(eim);
|
assert(eim);
|
||||||
|
@ -396,7 +396,7 @@ evas_cache_engine_image_size_set(RGBA_Engine_Image *eim, int w, int h)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char* cache_key = NULL;
|
const char *cache_key = NULL;
|
||||||
|
|
||||||
cache_key = eim->cache_key ? evas_stringshare_add(eim->cache_key) : NULL;
|
cache_key = eim->cache_key ? evas_stringshare_add(eim->cache_key) : NULL;
|
||||||
new->cache_key = cache_key;
|
new->cache_key = cache_key;
|
||||||
|
@ -422,7 +422,7 @@ evas_cache_engine_image_size_set(RGBA_Engine_Image *eim, int w, int h)
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_cache_engine_image_load_data(RGBA_Engine_Image *eim)
|
evas_cache_engine_image_load_data(RGBA_Engine_Image *eim)
|
||||||
{
|
{
|
||||||
Evas_Cache_Engine_Image* cache;
|
Evas_Cache_Engine_Image *cache;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
assert(eim);
|
assert(eim);
|
||||||
|
@ -445,10 +445,10 @@ evas_cache_engine_image_load_data(RGBA_Engine_Image *eim)
|
||||||
eim->flags.loaded = 1;
|
eim->flags.loaded = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Engine_Image*
|
EAPI RGBA_Engine_Image *
|
||||||
evas_cache_engine_image_engine(Evas_Cache_Engine_Image *cache, void *engine_data)
|
evas_cache_engine_image_engine(Evas_Cache_Engine_Image *cache, void *engine_data)
|
||||||
{
|
{
|
||||||
RGBA_Engine_Image* eim;
|
RGBA_Engine_Image *eim;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
eim = malloc(sizeof(RGBA_Engine_Image));
|
eim = malloc(sizeof(RGBA_Engine_Image));
|
||||||
|
@ -481,9 +481,9 @@ evas_cache_engine_image_engine(Evas_Cache_Engine_Image *cache, void *engine_data
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_cache_engine_image_colorspace(RGBA_Engine_Image* eim, int cspace, void* engine_data)
|
evas_cache_engine_image_colorspace(RGBA_Engine_Image *eim, int cspace, void *engine_data)
|
||||||
{
|
{
|
||||||
Evas_Cache_Engine_Image* cache = eim->cache;
|
Evas_Cache_Engine_Image *cache = eim->cache;
|
||||||
|
|
||||||
assert(cache);
|
assert(cache);
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,10 @@ evas_cache_image_set(Evas_Cache_Image *cache, int limit)
|
||||||
cache->limit = limit;
|
cache->limit = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_Cache_Image*
|
EAPI Evas_Cache_Image *
|
||||||
evas_cache_image_init(const Evas_Cache_Image_Func *cb)
|
evas_cache_image_init(const Evas_Cache_Image_Func *cb)
|
||||||
{
|
{
|
||||||
Evas_Cache_Image* new;
|
Evas_Cache_Image *new;
|
||||||
|
|
||||||
new = malloc(sizeof (Evas_Cache_Image));
|
new = malloc(sizeof (Evas_Cache_Image));
|
||||||
if (!new)
|
if (!new)
|
||||||
|
@ -56,14 +56,17 @@ evas_cache_image_init(const Evas_Cache_Image_Func *cb)
|
||||||
static Evas_Bool
|
static Evas_Bool
|
||||||
_evas_cache_image_free_cb(Evas_Hash *hash, const char *key, void *data, void *fdata)
|
_evas_cache_image_free_cb(Evas_Hash *hash, const char *key, void *data, void *fdata)
|
||||||
{
|
{
|
||||||
Evas_Cache_Image* cache = fdata;
|
Evas_Cache_Image *cache = fdata;
|
||||||
RGBA_Image* im = data;
|
RGBA_Image *im = data;
|
||||||
|
|
||||||
if (cache->func.debug)
|
if (cache->func.debug)
|
||||||
cache->func.debug("shutdown-activ", im);
|
cache->func.debug("shutdown-activ", im);
|
||||||
|
|
||||||
free(im->cache_key);
|
if (im->cache_key)
|
||||||
|
{
|
||||||
|
evas_stringshare_del(im->cache_key);
|
||||||
im->cache_key = NULL;
|
im->cache_key = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
cache->func.destructor(im);
|
cache->func.destructor(im);
|
||||||
evas_common_image_delete(im);
|
evas_common_image_delete(im);
|
||||||
|
@ -73,7 +76,7 @@ _evas_cache_image_free_cb(Evas_Hash *hash, const char *key, void *data, void *fd
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_cache_image_shutdown(Evas_Cache_Image *cache)
|
evas_cache_image_shutdown(Evas_Cache_Image *cache)
|
||||||
{
|
{
|
||||||
RGBA_Image* im;
|
RGBA_Image *im;
|
||||||
|
|
||||||
assert(cache != NULL);
|
assert(cache != NULL);
|
||||||
cache->references--;
|
cache->references--;
|
||||||
|
@ -83,11 +86,14 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache)
|
||||||
|
|
||||||
while (cache->lru)
|
while (cache->lru)
|
||||||
{
|
{
|
||||||
im = (RGBA_Image*) cache->lru;
|
im = (RGBA_Image *) cache->lru;
|
||||||
cache->lru = evas_object_list_remove(cache->lru, im);
|
cache->lru = evas_object_list_remove(cache->lru, im);
|
||||||
|
|
||||||
free(im->cache_key);
|
if (im->cache_key)
|
||||||
|
{
|
||||||
|
evas_stringshare_del(im->cache_key);
|
||||||
im->cache_key = NULL;
|
im->cache_key = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (cache->func.debug)
|
if (cache->func.debug)
|
||||||
cache->func.debug("shutdown-lru", im);
|
cache->func.debug("shutdown-lru", im);
|
||||||
|
@ -98,7 +104,7 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache)
|
||||||
/* This is mad, I am about to destroy image still alive, but we need to prevent leak. */
|
/* This is mad, I am about to destroy image still alive, but we need to prevent leak. */
|
||||||
while (cache->dirty)
|
while (cache->dirty)
|
||||||
{
|
{
|
||||||
im = (RGBA_Image*) cache->dirty;
|
im = (RGBA_Image *) cache->dirty;
|
||||||
cache->dirty = evas_object_list_remove(cache->dirty, im);
|
cache->dirty = evas_object_list_remove(cache->dirty, im);
|
||||||
|
|
||||||
if (cache->func.debug)
|
if (cache->func.debug)
|
||||||
|
@ -114,12 +120,12 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache)
|
||||||
free(cache);
|
free(cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Image*
|
EAPI RGBA_Image *
|
||||||
evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error)
|
evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error)
|
||||||
{
|
{
|
||||||
const char* format;
|
const char *format;
|
||||||
char* hkey;
|
char *hkey;
|
||||||
RGBA_Image* im;
|
RGBA_Image *im;
|
||||||
Evas_Image_Load_Opts prevent;
|
Evas_Image_Load_Opts prevent;
|
||||||
int size;
|
int size;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
@ -243,7 +249,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_cache_image_drop(RGBA_Image *im)
|
evas_cache_image_drop(RGBA_Image *im)
|
||||||
{
|
{
|
||||||
Evas_Cache_Image* cache;
|
Evas_Cache_Image *cache;
|
||||||
|
|
||||||
assert(im);
|
assert(im);
|
||||||
assert(im->cache);
|
assert(im->cache);
|
||||||
|
@ -278,11 +284,11 @@ evas_cache_image_drop(RGBA_Image *im)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Image*
|
EAPI RGBA_Image *
|
||||||
evas_cache_image_dirty(RGBA_Image *im, int x, int y, int w, int h)
|
evas_cache_image_dirty(RGBA_Image *im, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
RGBA_Image* im_dirty = im;
|
RGBA_Image *im_dirty = im;
|
||||||
Evas_Cache_Image* cache;
|
Evas_Cache_Image *cache;
|
||||||
|
|
||||||
assert(im);
|
assert(im);
|
||||||
assert(im->cache);
|
assert(im->cache);
|
||||||
|
@ -342,12 +348,11 @@ evas_cache_image_dirty(RGBA_Image *im, int x, int y, int w, int h)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Image*
|
EAPI RGBA_Image *
|
||||||
evas_cache_image_alone(RGBA_Image *im)
|
evas_cache_image_alone(RGBA_Image *im)
|
||||||
{
|
{
|
||||||
RGBA_Image* im_dirty = im;
|
RGBA_Image *im_dirty = im;
|
||||||
Evas_Cache_Image* cache;
|
Evas_Cache_Image *cache;
|
||||||
char* hkey;
|
|
||||||
|
|
||||||
assert(im);
|
assert(im);
|
||||||
assert(im->cache);
|
assert(im->cache);
|
||||||
|
@ -407,8 +412,8 @@ evas_cache_image_alone(RGBA_Image *im)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RGBA_Image*
|
static RGBA_Image *
|
||||||
_evas_cache_image_push_dirty(Evas_Cache_Image *cache, RGBA_Image* im)
|
_evas_cache_image_push_dirty(Evas_Cache_Image *cache, RGBA_Image *im)
|
||||||
{
|
{
|
||||||
cache->dirty = evas_object_list_prepend(cache->dirty, im);
|
cache->dirty = evas_object_list_prepend(cache->dirty, im);
|
||||||
|
|
||||||
|
@ -422,10 +427,10 @@ _evas_cache_image_push_dirty(Evas_Cache_Image *cache, RGBA_Image* im)
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Image*
|
EAPI RGBA_Image *
|
||||||
evas_cache_image_copied_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace)
|
evas_cache_image_copied_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace)
|
||||||
{
|
{
|
||||||
RGBA_Image* im;
|
RGBA_Image *im;
|
||||||
|
|
||||||
assert(cache);
|
assert(cache);
|
||||||
|
|
||||||
|
@ -445,10 +450,10 @@ evas_cache_image_copied_data(Evas_Cache_Image *cache, int w, int h, DATA32 *imag
|
||||||
return _evas_cache_image_push_dirty(cache, im);
|
return _evas_cache_image_push_dirty(cache, im);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Image*
|
EAPI RGBA_Image *
|
||||||
evas_cache_image_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace)
|
evas_cache_image_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace)
|
||||||
{
|
{
|
||||||
RGBA_Image* im;
|
RGBA_Image *im;
|
||||||
|
|
||||||
assert(cache);
|
assert(cache);
|
||||||
|
|
||||||
|
@ -470,11 +475,11 @@ evas_cache_image_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data,
|
||||||
return _evas_cache_image_push_dirty(cache, im);
|
return _evas_cache_image_push_dirty(cache, im);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Image*
|
EAPI RGBA_Image *
|
||||||
evas_cache_image_size_set(RGBA_Image *im, int w, int h)
|
evas_cache_image_size_set(RGBA_Image *im, int w, int h)
|
||||||
{
|
{
|
||||||
Evas_Cache_Image* cache;
|
Evas_Cache_Image *cache;
|
||||||
RGBA_Image* new;
|
RGBA_Image *new;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
assert(im);
|
assert(im);
|
||||||
|
@ -533,8 +538,7 @@ evas_cache_image_size_set(RGBA_Image *im, int w, int h)
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_cache_image_load_data(RGBA_Image *im)
|
evas_cache_image_load_data(RGBA_Image *im)
|
||||||
{
|
{
|
||||||
Evas_Cache_Image* cache;
|
Evas_Cache_Image *cache;
|
||||||
int size;
|
|
||||||
|
|
||||||
assert(im);
|
assert(im);
|
||||||
assert(im->image);
|
assert(im->image);
|
||||||
|
@ -562,9 +566,9 @@ evas_cache_image_flush(Evas_Cache_Image *cache)
|
||||||
|
|
||||||
while ((cache->lru) && (cache->limit < cache->usage))
|
while ((cache->lru) && (cache->limit < cache->usage))
|
||||||
{
|
{
|
||||||
RGBA_Image* im;
|
RGBA_Image *im;
|
||||||
|
|
||||||
im = (RGBA_Image*) cache->lru->last;
|
im = (RGBA_Image *) cache->lru->last;
|
||||||
cache->lru = evas_object_list_remove(cache->lru, im);
|
cache->lru = evas_object_list_remove(cache->lru, im);
|
||||||
cache->inactiv = evas_hash_del(cache->inactiv, im->cache_key, im);
|
cache->inactiv = evas_hash_del(cache->inactiv, im->cache_key, im);
|
||||||
cache->usage -= cache->func.mem_size_get(im);
|
cache->usage -= cache->func.mem_size_get(im);
|
||||||
|
@ -580,10 +584,10 @@ evas_cache_image_flush(Evas_Cache_Image *cache)
|
||||||
return cache->usage;
|
return cache->usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI RGBA_Image*
|
EAPI RGBA_Image *
|
||||||
evas_cache_image_empty(Evas_Cache_Image* cache)
|
evas_cache_image_empty(Evas_Cache_Image *cache)
|
||||||
{
|
{
|
||||||
RGBA_Image* new;
|
RGBA_Image *new;
|
||||||
|
|
||||||
new = evas_common_image_new();
|
new = evas_common_image_new();
|
||||||
if (!new) goto on_error;
|
if (!new) goto on_error;
|
||||||
|
@ -606,7 +610,7 @@ evas_cache_image_empty(Evas_Cache_Image* cache)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_cache_image_colorspace(RGBA_Image* im, int cspace)
|
evas_cache_image_colorspace(RGBA_Image *im, int cspace)
|
||||||
{
|
{
|
||||||
if (!im) return ;
|
if (!im) return ;
|
||||||
if (im->cs.space == cspace) return ;
|
if (im->cs.space == cspace) return ;
|
||||||
|
|
|
@ -410,7 +410,7 @@ struct _RGBA_Image
|
||||||
|
|
||||||
/* Cache stuff. */
|
/* Cache stuff. */
|
||||||
Evas_Cache_Image *cache;
|
Evas_Cache_Image *cache;
|
||||||
char *cache_key;
|
const char *cache_key;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _RGBA_Engine_Image
|
struct _RGBA_Engine_Image
|
||||||
|
|
Loading…
Reference in New Issue