#include "evas_gl_private.h"
+#ifdef EVAS_CSERVE2
+#include "evas_cs2_private.h"
+#endif
+
void
evas_gl_common_image_alloc_ensure(Evas_GL_Image *im)
{
EINA_LIST_FOREACH(gc->shared->images, l, im)
{
- if (im->im) evas_cache_image_unload_data(&im->im->cache_entry);
+ if (im->im)
+ {
+#ifdef EVAS_CSERVE2
+ if (evas_cache2_image_cached(&im->im->cache_entry))
+ evas_cache2_image_unload_data(&im->im->cache_entry);
+ else
+#endif
+ evas_cache_image_unload_data(&im->im->cache_entry);
+ }
if (im->tex)
{
if (!im->tex->pt->dyn.img)
im = calloc(1, sizeof(Evas_GL_Image));
if (!im)
{
- evas_cache_image_drop(&(im_im->cache_entry));
+#ifdef EVAS_CSERVE2
+ if (evas_cache2_image_cached(&im_im->cache_entry))
+ evas_cache2_image_close(&(im_im->cache_entry));
+ else
+#endif
+ evas_cache_image_drop(&(im_im->cache_entry));
*error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
return NULL;
}
{
RGBA_Image *im_im;
+#ifdef EVAS_CSERVE2
+ if (evas_cserve2_use_get())
+ {
+ im_im = (RGBA_Image *) evas_cache2_image_open
+ (evas_common_image_cache2_get(), file, key, lo, error);
+ if (im_im)
+ {
+ *error = evas_cache2_image_open_wait(&im_im->cache_entry);
+ if ((*error != EVAS_LOAD_ERROR_NONE)
+ && im_im->cache_entry.animated.animated)
+ {
+ evas_cache2_image_close(&im_im->cache_entry);
+ im_im = NULL;
+ }
+ else
+ return _evas_gl_common_image(gc, im_im, lo, error);
+ }
+ }
+#endif
+
im_im = evas_common_load_image_from_file(file, key, lo, error);
if (!im_im) return NULL;
{
RGBA_Image *im_im;
+#ifdef EVAS_CSERVE2
+ if (evas_cserve2_use_get() && !eina_file_virtual(f))
+ {
+ im_im = (RGBA_Image *) evas_cache2_image_open
+ (evas_common_image_cache2_get(), eina_file_filename_get(f), key, lo, error);
+ if (im_im)
+ {
+ *error = evas_cache2_image_open_wait(&im_im->cache_entry);
+ if ((*error != EVAS_LOAD_ERROR_NONE)
+ && im_im->cache_entry.animated.animated)
+ {
+ evas_cache2_image_close(&im_im->cache_entry);
+ im_im = NULL;
+ }
+ else
+ return _evas_gl_common_image(gc, im_im, lo, error);
+ }
+ }
+#endif
+
im_im = evas_common_load_image_from_mmap(f, key, lo, error);
if (!im_im) return NULL;
im->alpha = alpha;
if (!im->im) return im;
evas_gl_common_image_alloc_ensure(im);
- evas_cache_image_load_data(&im->im->cache_entry);
+#ifdef EVAS_CSERVE2
+ if (evas_cache2_image_cached(&im->im->cache_entry))
+ evas_cache2_image_load_data(&im->im->cache_entry);
+ else
+#endif
+ evas_cache_image_load_data(&im->im->cache_entry);
im->im->cache_entry.flags.alpha = alpha ? 1 : 0;
if (im->tex) evas_gl_common_texture_free(im->tex, EINA_TRUE);
}
if (im->im)
{
- evas_cache_image_drop(&im->im->cache_entry);
+#ifdef EVAS_CSERVE2
+ if (evas_cache2_image_cached(&im->im->cache_entry))
+ evas_cache2_image_close(&im->im->cache_entry);
+ else
+#endif
+ evas_cache_image_drop(&im->im->cache_entry);
im->im = NULL;
}
if (im->tex)
{
if (im->im)
{
- evas_cache_image_drop(&im->im->cache_entry);
+#ifdef EVAS_CSERVE2
+ if (!evas_cache2_image_cached(&im->im->cache_entry))
+ evas_cache2_image_close(&im->im->cache_entry);
+ else
+#endif
+ evas_cache_image_drop(&im->im->cache_entry);
im->im = NULL;
}
if (im->tex)
}
if (im->im)
{
- evas_cache_image_drop(&im->im->cache_entry);
+#ifdef EVAS_CSERVE2
+ if (evas_cache2_image_cached(&im->im->cache_entry))
+ evas_cache2_image_close(&im->im->cache_entry);
+ else
+#endif
+ evas_cache_image_drop(&im->im->cache_entry);
im->im = NULL;
}
if (im->tex)
{
if (im->im)
{
- evas_cache_image_drop(&im->im->cache_entry);
+#ifdef EVAS_CSERVE2
+ if (evas_cache2_image_cached(&im->im->cache_entry))
+ evas_cache2_image_close(&im->im->cache_entry);
+ else
+#endif
+ evas_cache_image_drop(&im->im->cache_entry);
im->im = NULL;
}
if (im->tex)
{
if (_evas_gl_image_cache_add(im)) return;
}
- if (im->im) evas_cache_image_drop(&im->im->cache_entry);
+ if (im->im)
+ {
+#ifdef EVAS_CSERVE2
+ if (evas_cache2_image_cached(&im->im->cache_entry))
+ evas_cache2_image_close(&im->im->cache_entry);
+ else
+#endif
+ evas_cache_image_drop(&im->im->cache_entry);
+ }
if (im->tex) evas_gl_common_texture_free(im->tex, EINA_TRUE);
free(im);
if (im->im)
{
evas_gl_common_image_alloc_ensure(im);
- im->im = (RGBA_Image *)evas_cache_image_dirty(&im->im->cache_entry, x, y, w, h);
+#ifdef EVAS_CSERVE2
+ if (evas_cache2_image_cached(&im->im->cache_entry))
+ im->im = (RGBA_Image *)evas_cache2_image_dirty(&im->im->cache_entry, x, y, w, h);
+ else
+#endif
+ im->im = (RGBA_Image *)evas_cache_image_dirty(&im->im->cache_entry, x, y, w, h);
}
im->dirty = 1;
}
if ((im->tex) &&
((im->dirty) || (ie->animated.animated) || (ie->flags.updated_data)))
{
- evas_cache_image_load_data(&im->im->cache_entry);
- evas_gl_common_texture_update(im->tex, im->im);
- evas_cache_image_unload_data(&im->im->cache_entry);
+#ifdef EVAS_CSERVE2
+ if (evas_cache2_image_cached(&im->im->cache_entry))
+ {
+ evas_cache2_image_load_data(&im->im->cache_entry);
+ evas_gl_common_texture_update(im->tex, im->im);
+ evas_cache2_image_unload_data(&im->im->cache_entry);
+ }
+ else
+#endif
+ {
+ evas_cache_image_load_data(&im->im->cache_entry);
+ evas_gl_common_texture_update(im->tex, im->im);
+ evas_cache_image_unload_data(&im->im->cache_entry);
+ }
ie->flags.updated_data = 0;
}
if (!im->tex)
{
- evas_cache_image_load_data(&im->im->cache_entry);
- im->tex = evas_gl_common_texture_new(gc, im->im);
- evas_cache_image_unload_data(&im->im->cache_entry);
+#ifdef EVAS_CSERVE2
+ if (evas_cache2_image_cached(&im->im->cache_entry))
+ {
+ evas_cache2_image_load_data(&im->im->cache_entry);
+ im->tex = evas_gl_common_texture_new(gc, im->im);
+ evas_cache2_image_unload_data(&im->im->cache_entry);
+ }
+ else
+#endif
+ {
+ evas_cache_image_load_data(&im->im->cache_entry);
+ im->tex = evas_gl_common_texture_new(gc, im->im);
+ evas_cache_image_unload_data(&im->im->cache_entry);
+ }
}
im->dirty = 0;
if (!im->tex) return;