forked from enlightenment/efl
evas/cserve2: Fallback to normal cache for mmap
cserve2 can't handle virtual files (mmap-only), by design. Proper support can be added later on, but for now we might want to just fallback to the normal cache functions. Fixes photocam test
This commit is contained in:
parent
808c20f989
commit
d76e869a59
|
@ -549,6 +549,13 @@ evas_cache2_shutdown(Evas_Cache2 *cache)
|
||||||
free(cache);
|
free(cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
evas_cache2_image_cached(Image_Entry *ie)
|
||||||
|
{
|
||||||
|
if (!ie) return EINA_FALSE;
|
||||||
|
return (ie->cache2 != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_cache2_image_cache_key_create(char *hkey, const char *path, size_t pathlen,
|
evas_cache2_image_cache_key_create(char *hkey, const char *path, size_t pathlen,
|
||||||
const char *key, size_t keylen,
|
const char *key, size_t keylen,
|
||||||
|
|
|
@ -76,6 +76,7 @@ EAPI Image_Entry * evas_cache2_image_size_set(Image_Entry *im, unsigned int w, u
|
||||||
EAPI Image_Entry * evas_cache2_image_dirty(Image_Entry *im, unsigned int x, unsigned int y, unsigned int w, unsigned int h);
|
EAPI Image_Entry * evas_cache2_image_dirty(Image_Entry *im, unsigned int x, unsigned int y, unsigned int w, unsigned int h);
|
||||||
EAPI Image_Entry * evas_cache2_image_empty(Evas_Cache2 *cache);
|
EAPI Image_Entry * evas_cache2_image_empty(Evas_Cache2 *cache);
|
||||||
EAPI void evas_cache2_image_surface_alloc(Image_Entry *ie, int w, int h);
|
EAPI void evas_cache2_image_surface_alloc(Image_Entry *ie, int w, int h);
|
||||||
|
EAPI Eina_Bool evas_cache2_image_cached(Image_Entry *ie);
|
||||||
|
|
||||||
EAPI int evas_cache2_flush(Evas_Cache2 *cache);
|
EAPI int evas_cache2_flush(Evas_Cache2 *cache);
|
||||||
EAPI void evas_cache2_limit_set(Evas_Cache2 *cache, int limit);
|
EAPI void evas_cache2_limit_set(Evas_Cache2 *cache, int limit);
|
||||||
|
|
|
@ -1571,7 +1571,7 @@ static Eina_Bool
|
||||||
_drop_image_cache_ref(const void *container EINA_UNUSED, void *data, void *fdata EINA_UNUSED)
|
_drop_image_cache_ref(const void *container EINA_UNUSED, void *data, void *fdata EINA_UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef EVAS_CSERVE2
|
#ifdef EVAS_CSERVE2
|
||||||
if (evas_cserve2_use_get())
|
if (evas_cserve2_use_get() && evas_cache2_image_cached(data))
|
||||||
evas_cache2_image_close((Image_Entry *)data);
|
evas_cache2_image_close((Image_Entry *)data);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -962,7 +962,7 @@ eng_image_mmap(void *data EINA_UNUSED, Eina_File *f, const char *key, int *error
|
||||||
*error = EVAS_LOAD_ERROR_NONE;
|
*error = EVAS_LOAD_ERROR_NONE;
|
||||||
#ifdef EVAS_CSERVE2
|
#ifdef EVAS_CSERVE2
|
||||||
// FIXME: Need to pass fd to make that useful, so just get the filename for now.
|
// FIXME: Need to pass fd to make that useful, so just get the filename for now.
|
||||||
if (evas_cserve2_use_get())
|
if (evas_cserve2_use_get() && !eina_file_virtual(f))
|
||||||
{
|
{
|
||||||
Image_Entry *ie;
|
Image_Entry *ie;
|
||||||
ie = evas_cache2_image_open(evas_common_image_cache2_get(),
|
ie = evas_cache2_image_open(evas_common_image_cache2_get(),
|
||||||
|
@ -1006,7 +1006,7 @@ static void
|
||||||
eng_image_free(void *data EINA_UNUSED, void *image)
|
eng_image_free(void *data EINA_UNUSED, void *image)
|
||||||
{
|
{
|
||||||
#ifdef EVAS_CSERVE2
|
#ifdef EVAS_CSERVE2
|
||||||
if (evas_cserve2_use_get())
|
if (evas_cserve2_use_get() && evas_cache2_image_cached(image))
|
||||||
{
|
{
|
||||||
evas_cache2_image_close(image);
|
evas_cache2_image_close(image);
|
||||||
return;
|
return;
|
||||||
|
@ -1031,7 +1031,7 @@ eng_image_size_set(void *data EINA_UNUSED, void *image, int w, int h)
|
||||||
Image_Entry *im = image;
|
Image_Entry *im = image;
|
||||||
if (!im) return NULL;
|
if (!im) return NULL;
|
||||||
#ifdef EVAS_CSERVE2
|
#ifdef EVAS_CSERVE2
|
||||||
if (evas_cserve2_use_get())
|
if (evas_cserve2_use_get() && evas_cache2_image_cached(im))
|
||||||
return evas_cache2_image_size_set(im, w, h);
|
return evas_cache2_image_size_set(im, w, h);
|
||||||
#endif
|
#endif
|
||||||
return evas_cache_image_size_set(im, w, h);
|
return evas_cache_image_size_set(im, w, h);
|
||||||
|
@ -1043,7 +1043,7 @@ eng_image_dirty_region(void *data EINA_UNUSED, void *image, int x, int y, int w,
|
||||||
Image_Entry *im = image;
|
Image_Entry *im = image;
|
||||||
if (!im) return NULL;
|
if (!im) return NULL;
|
||||||
#ifdef EVAS_CSERVE2
|
#ifdef EVAS_CSERVE2
|
||||||
if (evas_cserve2_use_get())
|
if (evas_cserve2_use_get() && evas_cache2_image_cached(im))
|
||||||
return evas_cache2_image_dirty(im, x, y, w, h);
|
return evas_cache2_image_dirty(im, x, y, w, h);
|
||||||
#endif
|
#endif
|
||||||
return evas_cache_image_dirty(im, x, y, w, h);
|
return evas_cache_image_dirty(im, x, y, w, h);
|
||||||
|
@ -1063,7 +1063,7 @@ eng_image_data_get(void *data EINA_UNUSED, void *image, int to_write, DATA32 **i
|
||||||
im = image;
|
im = image;
|
||||||
|
|
||||||
#ifdef EVAS_CSERVE2
|
#ifdef EVAS_CSERVE2
|
||||||
if (evas_cserve2_use_get())
|
if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
|
||||||
{
|
{
|
||||||
error = evas_cache2_image_load_data(&im->cache_entry);
|
error = evas_cache2_image_load_data(&im->cache_entry);
|
||||||
if (err) *err = error;
|
if (err) *err = error;
|
||||||
|
@ -1157,7 +1157,7 @@ eng_image_data_preload_request(void *data EINA_UNUSED, void *image, const Eo *ta
|
||||||
if (!im) return;
|
if (!im) return;
|
||||||
|
|
||||||
#ifdef EVAS_CSERVE2
|
#ifdef EVAS_CSERVE2
|
||||||
if (evas_cserve2_use_get())
|
if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
|
||||||
{
|
{
|
||||||
evas_cache2_image_preload_data(&im->cache_entry, target);
|
evas_cache2_image_preload_data(&im->cache_entry, target);
|
||||||
return;
|
return;
|
||||||
|
@ -1171,7 +1171,7 @@ eng_image_data_preload_cancel(void *data EINA_UNUSED, void *image, const Eo *tar
|
||||||
{
|
{
|
||||||
RGBA_Image *im = image;
|
RGBA_Image *im = image;
|
||||||
#ifdef EVAS_CSERVE2
|
#ifdef EVAS_CSERVE2
|
||||||
if (evas_cserve2_use_get())
|
if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue