summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-02-14 08:33:13 -0500
committerMike Blumenkrantz <zmike@samsung.com>2020-02-14 08:33:13 -0500
commit08b291e540902dccced85591f40ba2624d5cb0d4 (patch)
tree4c45d8d261d3854a92fbcf0c6f99837d8803663e
parentc1dd72fc917055eb8742afd4b8f115a52c254971 (diff)
Revert "evas: remove unused function evas_cache_engine_image_request."
Summary: This reverts commit 90e1ca715402371575104814162bcddd3664a8ba. Depends on D11334 Reviewers: raster Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11335
-rw-r--r--src/lib/evas/cache/evas_cache.h1
-rw-r--r--src/lib/evas/cache/evas_cache_engine_image.c69
2 files changed, 70 insertions, 0 deletions
diff --git a/src/lib/evas/cache/evas_cache.h b/src/lib/evas/cache/evas_cache.h
index cccb986..7475bc8 100644
--- a/src/lib/evas/cache/evas_cache.h
+++ b/src/lib/evas/cache/evas_cache.h
@@ -150,6 +150,7 @@ EAPI int evas_cache_engine_image_usage_get(Evas_Cache_Engin
150EAPI int evas_cache_engine_image_get(Evas_Cache_Engine_Image *cache); 150EAPI int evas_cache_engine_image_get(Evas_Cache_Engine_Image *cache);
151EAPI void evas_cache_engine_image_set(Evas_Cache_Engine_Image *cache, int limit); 151EAPI void evas_cache_engine_image_set(Evas_Cache_Engine_Image *cache, int limit);
152 152
153EAPI Engine_Image_Entry* evas_cache_engine_image_request(Evas_Cache_Engine_Image *cache, const char *file, const char *key, Evas_Image_Load_Opts *lo, void *engine_data, int *error);
153EAPI void evas_cache_engine_parent_not_needed(Engine_Image_Entry *eim); 154EAPI void evas_cache_engine_parent_not_needed(Engine_Image_Entry *eim);
154EAPI Engine_Image_Entry* evas_cache_engine_image_engine(Evas_Cache_Engine_Image *cache, void *engine_data); 155EAPI Engine_Image_Entry* evas_cache_engine_image_engine(Evas_Cache_Engine_Image *cache, void *engine_data);
155EAPI void evas_cache_engine_image_drop(Engine_Image_Entry *eim); 156EAPI void evas_cache_engine_image_drop(Engine_Image_Entry *eim);
diff --git a/src/lib/evas/cache/evas_cache_engine_image.c b/src/lib/evas/cache/evas_cache_engine_image.c
index 65d073a..3e98c01 100644
--- a/src/lib/evas/cache/evas_cache_engine_image.c
+++ b/src/lib/evas/cache/evas_cache_engine_image.c
@@ -288,6 +288,75 @@ evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image *cache)
288 free(cache); 288 free(cache);
289} 289}
290 290
291EAPI Engine_Image_Entry *
292evas_cache_engine_image_request(Evas_Cache_Engine_Image *cache,
293 const char *file, const char *key,
294 Evas_Image_Load_Opts *lo, void *data,
295 int *error)
296{
297 Engine_Image_Entry *eim;
298 Image_Entry *im;
299 const char *ekey;
300
301 assert(cache != NULL);
302
303 *error = EVAS_LOAD_ERROR_NONE;
304
305 ekey = NULL;
306 eim = NULL;
307
308 im = evas_cache_image_request(cache->parent, file, key, lo, error);
309 if (!im) goto on_error;
310
311 if (cache->func.key) ekey = cache->func.key(im, file, key, lo, data);
312 else ekey = eina_stringshare_add(im->cache_key);
313 if (!ekey)
314 {
315 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
316 goto on_error;
317 }
318
319 eim = eina_hash_find(cache->activ, ekey);
320 if (eim)
321 {
322 evas_cache_image_drop(im);
323 goto on_ok;
324 }
325
326 eim = eina_hash_find(cache->inactiv, ekey);
327 if (eim)
328 {
329 _evas_cache_engine_image_remove_activ(cache, eim);
330 _evas_cache_engine_image_make_active(cache, eim, ekey);
331 evas_cache_image_drop(im);
332 goto on_ok;
333 }
334
335 eim = _evas_cache_engine_image_alloc(cache, im, ekey);
336 if (!eim)
337 {
338 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
339 return NULL;
340 }
341
342 *error = cache->func.constructor(eim, data);
343 if (*error != EVAS_LOAD_ERROR_NONE) goto on_error;
344 if (cache->func.debug) cache->func.debug("constructor-engine", eim);
345
346on_ok:
347 eim->references++;
348 return eim;
349
350on_error:
351 if (!eim)
352 {
353 if (im) evas_cache_image_drop(im);
354 }
355 else _evas_cache_engine_image_dealloc(cache, eim);
356
357 return NULL;
358}
359
291EAPI void 360EAPI void
292evas_cache_engine_image_drop(Engine_Image_Entry *eim) 361evas_cache_engine_image_drop(Engine_Image_Entry *eim)
293{ 362{