Evas: Add engine function image_ref

This is to simplify and fix filters. This is an internal function.
This commit is contained in:
Jean-Philippe Andre 2015-10-08 14:00:39 +09:00
parent 62940b41f2
commit a8243ed382
3 changed files with 27 additions and 0 deletions

View File

@ -1311,6 +1311,7 @@ struct _Evas_Func
void *(*image_new_from_data) (void *data, int w, int h, DATA32 *image_data, int alpha, Evas_Colorspace cspace);
void *(*image_new_from_copied_data) (void *data, int w, int h, DATA32 *image_data, int alpha, Evas_Colorspace cspace);
void (*image_free) (void *data, void *image);
void *(*image_ref) (void *data, void *image);
void (*image_size_get) (void *data, void *image, int *w, int *h);
void *(*image_size_set) (void *data, void *image, int w, int h);
void (*image_stride_get) (void *data, void *image, int *stride);

View File

@ -527,6 +527,15 @@ eng_image_free(void *data, void *image)
evas_gl_common_image_free(image);
}
static void *
eng_image_ref(void *data EINA_UNUSED, void *image)
{
Evas_GL_Image *im = image;
if (!im) return NULL;
im->references++;
return im;
}
static void
eng_image_size_get(void *data EINA_UNUSED, void *image, int *w, int *h)
{
@ -2591,6 +2600,7 @@ module_open(Evas_Module *em)
ORD(image_new_from_data);
ORD(image_new_from_copied_data);
ORD(image_free);
ORD(image_ref);
ORD(image_size_get);
ORD(image_size_set);
ORD(image_dirty_region);

View File

@ -1221,6 +1221,21 @@ eng_image_free(void *data EINA_UNUSED, void *image)
evas_cache_image_drop(image);
}
static void *
eng_image_ref(void *data EINA_UNUSED, void *image)
{
if (!image) return NULL;
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get() && evas_cache2_image_cached(image))
{
evas_cache2_image_ref(image);
return image;
}
#endif
evas_cache_image_ref(image);
return image;
}
static void
eng_image_size_get(void *data EINA_UNUSED, void *image, int *w, int *h)
{
@ -3980,6 +3995,7 @@ static Evas_Func func =
eng_image_new_from_data,
eng_image_new_from_copied_data,
eng_image_free,
eng_image_ref,
eng_image_size_get,
eng_image_size_set,
NULL, // eng_image_stride_get