aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/cache
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-04-22 09:19:23 +1000
committerDavid Walter Seikel2012-04-22 09:19:23 +1000
commitc963d75dfdeec11f82e79e727062fbf89afa2c04 (patch)
tree895633dbf641110be46f117c29890c49b3ffc0bd /libraries/evas/src/lib/cache
parentAdding the new extantz viewer and grid manager. (diff)
downloadSledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.zip
SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.gz
SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.bz2
SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.xz
Update EFL to latest beta.
Diffstat (limited to 'libraries/evas/src/lib/cache')
-rw-r--r--libraries/evas/src/lib/cache/Makefile.am1
-rw-r--r--libraries/evas/src/lib/cache/Makefile.in9
-rw-r--r--libraries/evas/src/lib/cache/evas_cache_image.c338
3 files changed, 174 insertions, 174 deletions
diff --git a/libraries/evas/src/lib/cache/Makefile.am b/libraries/evas/src/lib/cache/Makefile.am
index d417262..78d58d2 100644
--- a/libraries/evas/src/lib/cache/Makefile.am
+++ b/libraries/evas/src/lib/cache/Makefile.am
@@ -7,7 +7,6 @@ AM_CPPFLAGS = -I. \
7 -DPACKAGE_BIN_DIR=\"$(bindir)\" \ 7 -DPACKAGE_BIN_DIR=\"$(bindir)\" \
8 -DPACKAGE_LIB_DIR=\"$(libdir)\" \ 8 -DPACKAGE_LIB_DIR=\"$(libdir)\" \
9 -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ 9 -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
10 @WIN32_CPPFLAGS@ \
11 @EVIL_CFLAGS@ \ 10 @EVIL_CFLAGS@ \
12 @FREETYPE_CFLAGS@ \ 11 @FREETYPE_CFLAGS@ \
13 @PIXMAN_CFLAGS@ \ 12 @PIXMAN_CFLAGS@ \
diff --git a/libraries/evas/src/lib/cache/Makefile.in b/libraries/evas/src/lib/cache/Makefile.in
index 2b50c81..fce77cc 100644
--- a/libraries/evas/src/lib/cache/Makefile.in
+++ b/libraries/evas/src/lib/cache/Makefile.in
@@ -147,6 +147,8 @@ EVAS_SSE3_CFLAGS = @EVAS_SSE3_CFLAGS@
147EVIL_CFLAGS = @EVIL_CFLAGS@ 147EVIL_CFLAGS = @EVIL_CFLAGS@
148EVIL_LIBS = @EVIL_LIBS@ 148EVIL_LIBS = @EVIL_LIBS@
149EXEEXT = @EXEEXT@ 149EXEEXT = @EXEEXT@
150EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
151EXOTIC_LIBS = @EXOTIC_LIBS@
150FGREP = @FGREP@ 152FGREP = @FGREP@
151FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ 153FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
152FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ 154FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
@@ -197,6 +199,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
197PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 199PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
198PIXMAN_LIBS = @PIXMAN_LIBS@ 200PIXMAN_LIBS = @PIXMAN_LIBS@
199PKG_CONFIG = @PKG_CONFIG@ 201PKG_CONFIG = @PKG_CONFIG@
202PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
203PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
200PNG_CFLAGS = @PNG_CFLAGS@ 204PNG_CFLAGS = @PNG_CFLAGS@
201PNG_LIBS = @PNG_LIBS@ 205PNG_LIBS = @PNG_LIBS@
202RANLIB = @RANLIB@ 206RANLIB = @RANLIB@
@@ -215,8 +219,6 @@ VERSION = @VERSION@
215VMAJ = @VMAJ@ 219VMAJ = @VMAJ@
216WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ 220WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
217WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ 221WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
218WIN32_CFLAGS = @WIN32_CFLAGS@
219WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
220XCB_CFLAGS = @XCB_CFLAGS@ 222XCB_CFLAGS = @XCB_CFLAGS@
221XCB_GL_CFLAGS = @XCB_GL_CFLAGS@ 223XCB_GL_CFLAGS = @XCB_GL_CFLAGS@
222XCB_GL_LIBS = @XCB_GL_LIBS@ 224XCB_GL_LIBS = @XCB_GL_LIBS@
@@ -290,8 +292,6 @@ evas_engine_software_ddraw_cflags = @evas_engine_software_ddraw_cflags@
290evas_engine_software_ddraw_libs = @evas_engine_software_ddraw_libs@ 292evas_engine_software_ddraw_libs = @evas_engine_software_ddraw_libs@
291evas_engine_software_gdi_cflags = @evas_engine_software_gdi_cflags@ 293evas_engine_software_gdi_cflags = @evas_engine_software_gdi_cflags@
292evas_engine_software_gdi_libs = @evas_engine_software_gdi_libs@ 294evas_engine_software_gdi_libs = @evas_engine_software_gdi_libs@
293evas_engine_software_sdl_cflags = @evas_engine_software_sdl_cflags@
294evas_engine_software_sdl_libs = @evas_engine_software_sdl_libs@
295evas_engine_software_xcb_cflags = @evas_engine_software_xcb_cflags@ 295evas_engine_software_xcb_cflags = @evas_engine_software_xcb_cflags@
296evas_engine_software_xcb_libs = @evas_engine_software_xcb_libs@ 296evas_engine_software_xcb_libs = @evas_engine_software_xcb_libs@
297evas_engine_software_xlib_cflags = @evas_engine_software_xlib_cflags@ 297evas_engine_software_xlib_cflags = @evas_engine_software_xlib_cflags@
@@ -381,7 +381,6 @@ AM_CPPFLAGS = -I. \
381 -DPACKAGE_BIN_DIR=\"$(bindir)\" \ 381 -DPACKAGE_BIN_DIR=\"$(bindir)\" \
382 -DPACKAGE_LIB_DIR=\"$(libdir)\" \ 382 -DPACKAGE_LIB_DIR=\"$(libdir)\" \
383 -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ 383 -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
384 @WIN32_CPPFLAGS@ \
385 @EVIL_CFLAGS@ \ 384 @EVIL_CFLAGS@ \
386 @FREETYPE_CFLAGS@ \ 385 @FREETYPE_CFLAGS@ \
387 @PIXMAN_CFLAGS@ \ 386 @PIXMAN_CFLAGS@ \
diff --git a/libraries/evas/src/lib/cache/evas_cache_image.c b/libraries/evas/src/lib/cache/evas_cache_image.c
index 73e4f8a..d5b72c5 100644
--- a/libraries/evas/src/lib/cache/evas_cache_image.c
+++ b/libraries/evas/src/lib/cache/evas_cache_image.c
@@ -42,10 +42,10 @@ static void _evas_cache_image_entry_preload_remove(Image_Entry *ie, const void *
42 42
43#define FREESTRC(Var) \ 43#define FREESTRC(Var) \
44 if (Var) \ 44 if (Var) \
45 { \ 45{ \
46 eina_stringshare_del(Var); \ 46 eina_stringshare_del(Var); \
47 Var = NULL; \ 47 Var = NULL; \
48 } 48}
49 49
50static void _evas_cache_image_dirty_add(Image_Entry *im); 50static void _evas_cache_image_dirty_add(Image_Entry *im);
51static void _evas_cache_image_dirty_del(Image_Entry *im); 51static void _evas_cache_image_dirty_del(Image_Entry *im);
@@ -210,9 +210,9 @@ _evas_cache_image_entry_delete(Evas_Cache_Image *cache, Image_Entry *ie)
210 if (ie->flags.delete_me == 1) return; 210 if (ie->flags.delete_me == 1) return;
211 if (ie->preload) 211 if (ie->preload)
212 { 212 {
213 ie->flags.delete_me = 1; 213 ie->flags.delete_me = 1;
214 _evas_cache_image_entry_preload_remove(ie, NULL); 214 _evas_cache_image_entry_preload_remove(ie, NULL);
215 return; 215 return;
216 } 216 }
217#endif 217#endif
218 218
@@ -247,10 +247,10 @@ _timestamp_compare(Image_Timestamp *tstamp, struct stat *st)
247#ifdef _STAT_VER_LINUX 247#ifdef _STAT_VER_LINUX
248#if (defined __USE_MISC && defined st_mtime) 248#if (defined __USE_MISC && defined st_mtime)
249 if (tstamp->mtime_nsec != (unsigned long int)st->st_mtim.tv_nsec) 249 if (tstamp->mtime_nsec != (unsigned long int)st->st_mtim.tv_nsec)
250 return EINA_FALSE; 250 return EINA_FALSE;
251#else 251#else
252 if (tstamp->mtime_nsec != (unsigned long int)st->st_mtimensec) 252 if (tstamp->mtime_nsec != (unsigned long int)st->st_mtimensec)
253 return EINA_FALSE; 253 return EINA_FALSE;
254#endif 254#endif
255#endif 255#endif
256 return EINA_TRUE; 256 return EINA_TRUE;
@@ -285,8 +285,8 @@ _evas_cache_image_entry_new(Evas_Cache_Image *cache,
285 ie = cache->func.alloc(); 285 ie = cache->func.alloc();
286 if (!ie) 286 if (!ie)
287 { 287 {
288 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; 288 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
289 return NULL; 289 return NULL;
290 } 290 }
291 ie->cache = cache; 291 ie->cache = cache;
292 if (hkey) ie->cache_key = eina_stringshare_add(hkey); 292 if (hkey) ie->cache_key = eina_stringshare_add(hkey);
@@ -307,7 +307,7 @@ _evas_cache_image_entry_new(Evas_Cache_Image *cache,
307 LKI(ie->lock); 307 LKI(ie->lock);
308 LKI(ie->lock_cancel); 308 LKI(ie->lock_cancel);
309#endif 309#endif
310 310
311 if (lo) ie->load_opts = *lo; 311 if (lo) ie->load_opts = *lo;
312 if (ie->file) 312 if (ie->file)
313 { 313 {
@@ -326,8 +326,8 @@ _evas_cache_image_entry_new(Evas_Cache_Image *cache,
326 326
327static void 327static void
328_evas_cache_image_entry_surface_alloc__locked(Evas_Cache_Image *cache, 328_evas_cache_image_entry_surface_alloc__locked(Evas_Cache_Image *cache,
329 Image_Entry *ie, 329 Image_Entry *ie,
330 unsigned int wmin, 330 unsigned int wmin,
331 unsigned int hmin) 331 unsigned int hmin)
332{ 332{
333 if ((ie->allocated.w == wmin) && (ie->allocated.h == hmin)) return; 333 if ((ie->allocated.w == wmin) && (ie->allocated.h == hmin)) return;
@@ -376,16 +376,16 @@ _evas_cache_image_async_heavy(void *data)
376 if ((!current->flags.loaded) && 376 if ((!current->flags.loaded) &&
377 ((Evas_Image_Load_Func*) current->info.module)->threadable) 377 ((Evas_Image_Load_Func*) current->info.module)->threadable)
378 { 378 {
379 error = cache->func.load(current); 379 error = cache->func.load(current);
380 if (cache->func.debug) cache->func.debug("load", current); 380 if (cache->func.debug) cache->func.debug("load", current);
381 current->load_error = error; 381 current->load_error = error;
382 if (error != EVAS_LOAD_ERROR_NONE) 382 if (error != EVAS_LOAD_ERROR_NONE)
383 { 383 {
384 current->flags.loaded = 0; 384 current->flags.loaded = 0;
385 _evas_cache_image_entry_surface_alloc(cache, current, 385 _evas_cache_image_entry_surface_alloc(cache, current,
386 current->w, current->h); 386 current->w, current->h);
387 } 387 }
388 else 388 else
389 { 389 {
390 current->flags.loaded = 1; 390 current->flags.loaded = 1;
391 } 391 }
@@ -416,11 +416,11 @@ _evas_cache_image_async_end(void *data)
416 ie->flags.preload_done = ie->flags.loaded; 416 ie->flags.preload_done = ie->flags.loaded;
417 while ((tmp = ie->targets)) 417 while ((tmp = ie->targets))
418 { 418 {
419 evas_object_inform_call_image_preloaded((Evas_Object*) tmp->target); 419 evas_object_inform_call_image_preloaded((Evas_Object*) tmp->target);
420 ie->targets = (Evas_Cache_Target *) 420 ie->targets = (Evas_Cache_Target *)
421 eina_inlist_remove(EINA_INLIST_GET(ie->targets), 421 eina_inlist_remove(EINA_INLIST_GET(ie->targets),
422 EINA_INLIST_GET(ie->targets)); 422 EINA_INLIST_GET(ie->targets));
423 free(tmp); 423 free(tmp);
424 } 424 }
425} 425}
426 426
@@ -429,14 +429,14 @@ _evas_cache_image_async_cancel(void *data)
429{ 429{
430 Evas_Cache_Image *cache = NULL; 430 Evas_Cache_Image *cache = NULL;
431 Image_Entry *ie = (Image_Entry *)data; 431 Image_Entry *ie = (Image_Entry *)data;
432 432
433 ie->preload = NULL; 433 ie->preload = NULL;
434 ie->cache->pending = eina_list_remove(ie->cache->pending, ie); 434 ie->cache->pending = eina_list_remove(ie->cache->pending, ie);
435 if ((ie->flags.delete_me) || (ie->flags.dirty)) 435 if ((ie->flags.delete_me) || (ie->flags.dirty))
436 { 436 {
437 ie->flags.delete_me = 0; 437 ie->flags.delete_me = 0;
438 _evas_cache_image_entry_delete(ie->cache, ie); 438 _evas_cache_image_entry_delete(ie->cache, ie);
439 return; 439 return;
440 } 440 }
441 if (ie->flags.loaded) _evas_cache_image_async_end(ie); 441 if (ie->flags.loaded) _evas_cache_image_async_end(ie);
442#ifdef EVAS_FRAME_QUEUING 442#ifdef EVAS_FRAME_QUEUING
@@ -485,41 +485,41 @@ _evas_cache_image_entry_preload_remove(Image_Entry *ie, const void *target)
485{ 485{
486 if (target) 486 if (target)
487 { 487 {
488 Evas_Cache_Target *tg; 488 Evas_Cache_Target *tg;
489 489
490 EINA_INLIST_FOREACH(ie->targets, tg) 490 EINA_INLIST_FOREACH(ie->targets, tg)
491 { 491 {
492 if (tg->target == target) 492 if (tg->target == target)
493 { 493 {
494 // FIXME: No callback when we cancel only for one target ? 494 // FIXME: No callback when we cancel only for one target ?
495 ie->targets = (Evas_Cache_Target *) 495 ie->targets = (Evas_Cache_Target *)
496 eina_inlist_remove(EINA_INLIST_GET(ie->targets), 496 eina_inlist_remove(EINA_INLIST_GET(ie->targets),
497 EINA_INLIST_GET(tg)); 497 EINA_INLIST_GET(tg));
498 free(tg); 498 free(tg);
499 break; 499 break;
500 } 500 }
501 } 501 }
502 } 502 }
503 else 503 else
504 { 504 {
505 Evas_Cache_Target *tg; 505 Evas_Cache_Target *tg;
506 506
507 while (ie->targets) 507 while (ie->targets)
508 { 508 {
509 tg = ie->targets; 509 tg = ie->targets;
510 ie->targets = (Evas_Cache_Target *) 510 ie->targets = (Evas_Cache_Target *)
511 eina_inlist_remove(EINA_INLIST_GET(ie->targets), 511 eina_inlist_remove(EINA_INLIST_GET(ie->targets),
512 EINA_INLIST_GET(tg)); 512 EINA_INLIST_GET(tg));
513 free(tg); 513 free(tg);
514 } 514 }
515 } 515 }
516 516
517 if ((!ie->targets) && (ie->preload) && (!ie->flags.pending)) 517 if ((!ie->targets) && (ie->preload) && (!ie->flags.pending))
518 { 518 {
519 ie->cache->preload = eina_list_remove(ie->cache->preload, ie); 519 ie->cache->preload = eina_list_remove(ie->cache->preload, ie);
520 ie->cache->pending = eina_list_append(ie->cache->pending, ie); 520 ie->cache->pending = eina_list_append(ie->cache->pending, ie);
521 ie->flags.pending = 1; 521 ie->flags.pending = 1;
522 evas_preload_thread_cancel(ie->preload); 522 evas_preload_thread_cancel(ie->preload);
523 } 523 }
524} 524}
525#endif 525#endif
@@ -566,7 +566,7 @@ evas_cache_image_init(const Evas_Cache_Image_Func *cb)
566 { 566 {
567 LKI(engine_lock); 567 LKI(engine_lock);
568 LKI(wakeup); 568 LKI(wakeup);
569 eina_condition_new(&cond_wakeup, &wakeup); 569 eina_condition_new(&cond_wakeup, &wakeup);
570 } 570 }
571#endif 571#endif
572 572
@@ -616,9 +616,9 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache)
616#ifdef BUILD_ASYNC_PRELOAD 616#ifdef BUILD_ASYNC_PRELOAD
617 EINA_LIST_FREE(cache->preload, im) 617 EINA_LIST_FREE(cache->preload, im)
618 { 618 {
619 /* By doing that we are protecting us from destroying image when the cache is no longer available. */ 619 /* By doing that we are protecting us from destroying image when the cache is no longer available. */
620 im->flags.delete_me = 1; 620 im->flags.delete_me = 1;
621 _evas_cache_image_entry_preload_remove(im, NULL); 621 _evas_cache_image_entry_preload_remove(im, NULL);
622 } 622 }
623 evas_async_events_process(); 623 evas_async_events_process();
624#endif 624#endif
@@ -642,21 +642,21 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache)
642 eina_hash_foreach(cache->activ, _evas_cache_image_free_cb, &delete_list); 642 eina_hash_foreach(cache->activ, _evas_cache_image_free_cb, &delete_list);
643 while (delete_list) 643 while (delete_list)
644 { 644 {
645 _evas_cache_image_entry_delete(cache, eina_list_data_get(delete_list)); 645 _evas_cache_image_entry_delete(cache, eina_list_data_get(delete_list));
646 delete_list = eina_list_remove_list(delete_list, delete_list); 646 delete_list = eina_list_remove_list(delete_list, delete_list);
647 } 647 }
648 648
649#ifdef BUILD_ASYNC_PRELOAD 649#ifdef BUILD_ASYNC_PRELOAD
650 /* Now wait for all pending image to die */ 650 /* Now wait for all pending image to die */
651 while (cache->pending) 651 while (cache->pending)
652 { 652 {
653 evas_async_events_process(); 653 evas_async_events_process();
654 LKL(wakeup); 654 LKL(wakeup);
655 // the lazy bum who did eain threads and converted this code 655 // the lazy bum who did eain threads and converted this code
656 // didn't bother to worry about Eina_Lock being a different type 656 // didn't bother to worry about Eina_Lock being a different type
657 // to a pthread mutex. 657 // to a pthread mutex.
658 if (cache->pending) eina_condition_wait(&cond_wakeup); 658 if (cache->pending) eina_condition_wait(&cond_wakeup);
659 LKU(wakeup); 659 LKU(wakeup);
660 } 660 }
661#endif 661#endif
662 eina_hash_free(cache->activ); 662 eina_hash_free(cache->activ);
@@ -666,7 +666,7 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache)
666#ifdef BUILD_ASYNC_PRELOAD 666#ifdef BUILD_ASYNC_PRELOAD
667 if (--_evas_cache_mutex_init == 0) 667 if (--_evas_cache_mutex_init == 0)
668 { 668 {
669 eina_condition_free(&cond_wakeup); 669 eina_condition_free(&cond_wakeup);
670 LKD(engine_lock); 670 LKD(engine_lock);
671 LKD(wakeup); 671 LKD(wakeup);
672 } 672 }
@@ -690,8 +690,8 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
690 690
691 if ((!file) || ((!file) && (!key))) 691 if ((!file) || ((!file) && (!key)))
692 { 692 {
693 *error = EVAS_LOAD_ERROR_GENERIC; 693 *error = EVAS_LOAD_ERROR_GENERIC;
694 return NULL; 694 return NULL;
695 } 695 }
696 696
697 /* generate hkey from file+key+load opts */ 697 /* generate hkey from file+key+load opts */
@@ -712,45 +712,45 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
712 (lo->dpi == 0.0) && 712 (lo->dpi == 0.0) &&
713 ((lo->w == 0) || (lo->h == 0)) && 713 ((lo->w == 0) || (lo->h == 0)) &&
714 ((lo->region.w == 0) || (lo->region.h == 0)) && 714 ((lo->region.w == 0) || (lo->region.h == 0)) &&
715 (lo->orientation == 0) 715 (lo->orientation == 0)
716 )) 716 ))
717 { 717 {
718 lo = &prevent; 718 lo = &prevent;
719 } 719 }
720 else 720 else
721 { 721 {
722 memcpy(hkey + size, "//@/", 4); 722 memcpy(hkey + size, "//@/", 4);
723 size += 4; 723 size += 4;
724 size += eina_convert_xtoa(lo->scale_down_by, hkey + size); 724 size += eina_convert_xtoa(lo->scale_down_by, hkey + size);
725 hkey[size] = '/'; 725 hkey[size] = '/';
726 size += 1; 726 size += 1;
727 size += eina_convert_dtoa(lo->dpi, hkey + size); 727 size += eina_convert_dtoa(lo->dpi, hkey + size);
728 hkey[size] = '/'; 728 hkey[size] = '/';
729 size += 1; 729 size += 1;
730 size += eina_convert_xtoa(lo->w, hkey + size); 730 size += eina_convert_xtoa(lo->w, hkey + size);
731 hkey[size] = 'x'; 731 hkey[size] = 'x';
732 size += 1; 732 size += 1;
733 size += eina_convert_xtoa(lo->h, hkey + size); 733 size += eina_convert_xtoa(lo->h, hkey + size);
734 hkey[size] = '/'; 734 hkey[size] = '/';
735 size += 1; 735 size += 1;
736 size += eina_convert_xtoa(lo->region.x, hkey + size); 736 size += eina_convert_xtoa(lo->region.x, hkey + size);
737 hkey[size] = '+'; 737 hkey[size] = '+';
738 size += 1; 738 size += 1;
739 size += eina_convert_xtoa(lo->region.y, hkey + size); 739 size += eina_convert_xtoa(lo->region.y, hkey + size);
740 hkey[size] = '.'; 740 hkey[size] = '.';
741 size += 1; 741 size += 1;
742 size += eina_convert_xtoa(lo->region.w, hkey + size); 742 size += eina_convert_xtoa(lo->region.w, hkey + size);
743 hkey[size] = 'x'; 743 hkey[size] = 'x';
744 size += 1; 744 size += 1;
745 size += eina_convert_xtoa(lo->region.h, hkey + size); 745 size += eina_convert_xtoa(lo->region.h, hkey + size);
746 746
747 if (lo->orientation) 747 if (lo->orientation)
748 { 748 {
749 hkey[size] = '/'; 749 hkey[size] = '/';
750 size += 1; 750 size += 1;
751 hkey[size] = 'o'; 751 hkey[size] = 'o';
752 size += 1; 752 size += 1;
753 } 753 }
754 } 754 }
755 hkey[size] = '\0'; 755 hkey[size] = '\0';
756 756
@@ -768,10 +768,10 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
768 768
769 stat_done = 1; 769 stat_done = 1;
770 if (stat(file, &st) < 0) 770 if (stat(file, &st) < 0)
771 { 771 {
772 stat_failed = 1; 772 stat_failed = 1;
773 ok = 0; 773 ok = 0;
774 } 774 }
775 else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0; 775 else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
776 if (ok) goto on_ok; 776 if (ok) goto on_ok;
777 /* image we found doesn't match what's on disk (stat info wise) 777 /* image we found doesn't match what's on disk (stat info wise)
@@ -816,10 +816,12 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
816 } 816 }
817 /* as avtive cache find - if we match in lru and its invalid, dirty */ 817 /* as avtive cache find - if we match in lru and its invalid, dirty */
818 _evas_cache_image_dirty_add(im); 818 _evas_cache_image_dirty_add(im);
819 /* this image never used, so it have to be deleted */
820 _evas_cache_image_entry_delete(cache, im);
819 im = NULL; 821 im = NULL;
820 } 822 }
821 if (stat_failed) goto on_stat_error; 823 if (stat_failed) goto on_stat_error;
822 824
823 if (!stat_done) 825 if (!stat_done)
824 { 826 {
825 if (stat(file, &st) < 0) goto on_stat_error; 827 if (stat(file, &st) < 0) goto on_stat_error;
@@ -830,7 +832,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
830 if (!im) goto on_stat_error; 832 if (!im) goto on_stat_error;
831 if (cache->func.debug) cache->func.debug("request", im); 833 if (cache->func.debug) cache->func.debug("request", im);
832 834
833 on_ok: 835on_ok:
834 *error = EVAS_LOAD_ERROR_NONE; 836 *error = EVAS_LOAD_ERROR_NONE;
835#ifdef EVAS_FRAME_QUEUING 837#ifdef EVAS_FRAME_QUEUING
836 LKL(im->lock_references); 838 LKL(im->lock_references);
@@ -841,24 +843,24 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
841#endif 843#endif
842 return im; 844 return im;
843 845
844 on_stat_error: 846on_stat_error:
845#ifndef _WIN32 847#ifndef _WIN32
846 if ((errno == ENOENT) || (errno == ENOTDIR) || 848 if ((errno == ENOENT) || (errno == ENOTDIR) ||
847 (errno == ENAMETOOLONG) || (errno == ELOOP)) 849 (errno == ENAMETOOLONG) || (errno == ELOOP))
848#else 850#else
849 if (errno == ENOENT) 851 if (errno == ENOENT)
850#endif 852#endif
851 *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; 853 *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
852#ifndef _WIN32 854#ifndef _WIN32
853 else if ((errno == ENOMEM) || (errno == EOVERFLOW)) 855 else if ((errno == ENOMEM) || (errno == EOVERFLOW))
854#else 856#else
855 else if (errno == ENOMEM) 857 else if (errno == ENOMEM)
856#endif 858#endif
857 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; 859 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
858 else if (errno == EACCES) 860 else if (errno == EACCES)
859 *error = EVAS_LOAD_ERROR_PERMISSION_DENIED; 861 *error = EVAS_LOAD_ERROR_PERMISSION_DENIED;
860 else 862 else
861 *error = EVAS_LOAD_ERROR_GENERIC; 863 *error = EVAS_LOAD_ERROR_GENERIC;
862 864
863 if (im) _evas_cache_image_entry_delete(cache, im); 865 if (im) _evas_cache_image_entry_delete(cache, im);
864 return NULL; 866 return NULL;
@@ -879,7 +881,7 @@ evas_cache_image_drop(Image_Entry *im)
879#ifdef EVAS_FRAME_QUEUING 881#ifdef EVAS_FRAME_QUEUING
880 LKU(im->lock_references); 882 LKU(im->lock_references);
881#endif 883#endif
882 884
883 cache = im->cache; 885 cache = im->cache;
884 886
885 if (references == 0) 887 if (references == 0)
@@ -893,25 +895,25 @@ evas_cache_image_drop(Image_Entry *im)
893 LKU(im->ref_fq_del); 895 LKU(im->ref_fq_del);
894 return; 896 return;
895 } 897 }
896 LKU(im->ref_fq_add); 898 LKU(im->ref_fq_add);
897 LKU(im->ref_fq_del); 899 LKU(im->ref_fq_del);
898#endif 900#endif
899 901
900#ifdef BUILD_ASYNC_PRELOAD 902#ifdef BUILD_ASYNC_PRELOAD
901 if (im->preload) 903 if (im->preload)
902 { 904 {
903 _evas_cache_image_entry_preload_remove(im, NULL); 905 _evas_cache_image_entry_preload_remove(im, NULL);
904 return; 906 return;
905 } 907 }
906#endif 908#endif
907 909
908 if (im->flags.dirty) 910 if (im->flags.dirty)
909 { 911 {
910 _evas_cache_image_entry_delete(cache, im); 912 _evas_cache_image_entry_delete(cache, im);
911 return; 913 return;
912 } 914 }
913 _evas_cache_image_lru_add(im); 915 _evas_cache_image_lru_add(im);
914 if (cache) evas_cache_image_flush(cache); 916 if (cache) evas_cache_image_flush(cache);
915 } 917 }
916} 918}
917 919
@@ -974,10 +976,10 @@ evas_cache_image_dirty(Image_Entry *im, unsigned int x, unsigned int y, unsigned
974 } 976 }
975 _evas_cache_image_dirty_add(im_dirty); 977 _evas_cache_image_dirty_add(im_dirty);
976 } 978 }
977 979
978 if (cache->func.debug) cache->func.debug("dirty-region", im_dirty); 980 if (cache->func.debug) cache->func.debug("dirty-region", im_dirty);
979 if (cache->func.dirty_region) 981 if (cache->func.dirty_region)
980 cache->func.dirty_region(im_dirty, x, y, w, h); 982 cache->func.dirty_region(im_dirty, x, y, w, h);
981 return im_dirty; 983 return im_dirty;
982 984
983on_error: 985on_error:
@@ -1026,7 +1028,7 @@ evas_cache_image_alone(Image_Entry *im)
1026 evas_cache_image_drop(im); 1028 evas_cache_image_drop(im);
1027 } 1029 }
1028 return im_dirty; 1030 return im_dirty;
1029 1031
1030on_error: 1032on_error:
1031 if (im_dirty) _evas_cache_image_entry_delete(cache, im_dirty); 1033 if (im_dirty) _evas_cache_image_entry_delete(cache, im_dirty);
1032 evas_cache_image_drop(im); 1034 evas_cache_image_drop(im);
@@ -1039,12 +1041,12 @@ evas_cache_image_copied_data(Evas_Cache_Image *cache,
1039 DATA32 *image_data, int alpha, int cspace) 1041 DATA32 *image_data, int alpha, int cspace)
1040{ 1042{
1041 Image_Entry *im; 1043 Image_Entry *im;
1042 1044
1043 if ((cspace == EVAS_COLORSPACE_YCBCR422P601_PL) || 1045 if ((cspace == EVAS_COLORSPACE_YCBCR422P601_PL) ||
1044 (cspace == EVAS_COLORSPACE_YCBCR422P709_PL) || 1046 (cspace == EVAS_COLORSPACE_YCBCR422P709_PL) ||
1045 (cspace == EVAS_COLORSPACE_YCBCR422601_PL)) 1047 (cspace == EVAS_COLORSPACE_YCBCR422601_PL))
1046 w &= ~0x1; 1048 w &= ~0x1;
1047 1049
1048 im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL); 1050 im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL);
1049 if (!im) return NULL; 1051 if (!im) return NULL;
1050 im->space = cspace; 1052 im->space = cspace;
@@ -1074,8 +1076,8 @@ evas_cache_image_data(Evas_Cache_Image *cache, unsigned int w, unsigned int h, D
1074 if ((cspace == EVAS_COLORSPACE_YCBCR422P601_PL) || 1076 if ((cspace == EVAS_COLORSPACE_YCBCR422P601_PL) ||
1075 (cspace == EVAS_COLORSPACE_YCBCR422P709_PL) || 1077 (cspace == EVAS_COLORSPACE_YCBCR422P709_PL) ||
1076 (cspace == EVAS_COLORSPACE_YCBCR422601_PL)) 1078 (cspace == EVAS_COLORSPACE_YCBCR422601_PL))
1077 w &= ~0x1; 1079 w &= ~0x1;
1078 1080
1079 im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL); 1081 im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL);
1080 if (!im) return NULL; 1082 if (!im) return NULL;
1081 im->w = w; 1083 im->w = w;
@@ -1101,7 +1103,7 @@ EAPI void
1101evas_cache_image_surface_alloc(Image_Entry *im, unsigned int w, unsigned int h) 1103evas_cache_image_surface_alloc(Image_Entry *im, unsigned int w, unsigned int h)
1102{ 1104{
1103 Evas_Cache_Image *cache = im->cache; 1105 Evas_Cache_Image *cache = im->cache;
1104 1106
1105 if ((im->space == EVAS_COLORSPACE_YCBCR422P601_PL) || 1107 if ((im->space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
1106 (im->space == EVAS_COLORSPACE_YCBCR422P709_PL) || 1108 (im->space == EVAS_COLORSPACE_YCBCR422P709_PL) ||
1107 (im->space == EVAS_COLORSPACE_YCBCR422601_PL)) 1109 (im->space == EVAS_COLORSPACE_YCBCR422601_PL))
@@ -1145,7 +1147,7 @@ evas_cache_image_size_set(Image_Entry *im, unsigned int w, unsigned int h)
1145 if (cache->func.debug) cache->func.debug("size_set", im2); 1147 if (cache->func.debug) cache->func.debug("size_set", im2);
1146 return im2; 1148 return im2;
1147 1149
1148 on_error: 1150on_error:
1149 if (im2) _evas_cache_image_entry_delete(cache, im2); 1151 if (im2) _evas_cache_image_entry_delete(cache, im2);
1150 evas_cache_image_drop(im); 1152 evas_cache_image_drop(im);
1151 return NULL; 1153 return NULL;
@@ -1163,26 +1165,26 @@ evas_cache_image_load_data(Image_Entry *im)
1163#ifdef BUILD_ASYNC_PRELOAD 1165#ifdef BUILD_ASYNC_PRELOAD
1164 if (im->preload) 1166 if (im->preload)
1165 { 1167 {
1166 preload = EINA_TRUE; 1168 preload = EINA_TRUE;
1167 if (!im->flags.pending) 1169 if (!im->flags.pending)
1168 { 1170 {
1169 im->cache->preload = eina_list_remove(im->cache->preload, im); 1171 im->cache->preload = eina_list_remove(im->cache->preload, im);
1170 im->cache->pending = eina_list_append(im->cache->pending, im); 1172 im->cache->pending = eina_list_append(im->cache->pending, im);
1171 im->flags.pending = 1; 1173 im->flags.pending = 1;
1172 evas_preload_thread_cancel(im->preload); 1174 evas_preload_thread_cancel(im->preload);
1173 } 1175 }
1174 evas_async_events_process(); 1176 evas_async_events_process();
1175 LKL(wakeup); 1177 LKL(wakeup);
1176 while (im->preload) 1178 while (im->preload)
1177 { 1179 {
1178 eina_condition_wait(&cond_wakeup); 1180 eina_condition_wait(&cond_wakeup);
1179 LKU(wakeup); 1181 LKU(wakeup);
1180 evas_async_events_process(); 1182 evas_async_events_process();
1181 LKL(wakeup); 1183 LKL(wakeup);
1182 } 1184 }
1183 LKU(wakeup); 1185 LKU(wakeup);
1184 } 1186 }
1185 1187
1186 if ((im->flags.loaded) && (!im->flags.animated)) return error; 1188 if ((im->flags.loaded) && (!im->flags.animated)) return error;
1187 LKL(im->lock); 1189 LKL(im->lock);
1188#endif 1190#endif
@@ -1226,7 +1228,7 @@ evas_cache_image_unload_data(Image_Entry *im)
1226#ifdef BUILD_ASYNC_PRELOAD 1228#ifdef BUILD_ASYNC_PRELOAD
1227 LKU(im->lock); 1229 LKU(im->lock);
1228#endif 1230#endif
1229 return; 1231 return;
1230 } 1232 }
1231 im->cache->func.destructor(im); 1233 im->cache->func.destructor(im);
1232#ifdef BUILD_ASYNC_PRELOAD 1234#ifdef BUILD_ASYNC_PRELOAD
@@ -1256,8 +1258,8 @@ evas_cache_image_unload_all(Evas_Cache_Image *cache)
1256EAPI Eina_Bool 1258EAPI Eina_Bool
1257evas_cache_image_is_loaded(Image_Entry *im) 1259evas_cache_image_is_loaded(Image_Entry *im)
1258{ 1260{
1259 if (im->flags.loaded) return EINA_TRUE; 1261 if (im->flags.loaded) return EINA_TRUE;
1260 return EINA_FALSE; 1262 return EINA_FALSE;
1261} 1263}
1262 1264
1263EAPI void 1265EAPI void
@@ -1265,15 +1267,15 @@ evas_cache_image_preload_data(Image_Entry *im, const void *target)
1265{ 1267{
1266#ifdef BUILD_ASYNC_PRELOAD 1268#ifdef BUILD_ASYNC_PRELOAD
1267 RGBA_Image *img = (RGBA_Image *)im; 1269 RGBA_Image *img = (RGBA_Image *)im;
1268 1270
1269 if ((im->flags.loaded) && (img->image.data)) 1271 if ((im->flags.loaded) && (img->image.data))
1270 { 1272 {
1271 evas_object_inform_call_image_preloaded((Evas_Object *)target); 1273 evas_object_inform_call_image_preloaded((Evas_Object *)target);
1272 return; 1274 return;
1273 } 1275 }
1274 im->flags.loaded = 0; 1276 im->flags.loaded = 0;
1275 if (!_evas_cache_image_entry_preload_add(im, target)) 1277 if (!_evas_cache_image_entry_preload_add(im, target))
1276 evas_object_inform_call_image_preloaded((Evas_Object *)target); 1278 evas_object_inform_call_image_preloaded((Evas_Object *)target);
1277#else 1279#else
1278 evas_cache_image_load_data(im); 1280 evas_cache_image_load_data(im);
1279 evas_object_inform_call_image_preloaded((Evas_Object *)target); 1281 evas_object_inform_call_image_preloaded((Evas_Object *)target);
@@ -1319,7 +1321,7 @@ static void
1319_dump_cache(Evas_Cache_Image *cache) 1321_dump_cache(Evas_Cache_Image *cache)
1320{ 1322{
1321 Image_Entry *im; 1323 Image_Entry *im;
1322 1324
1323 printf("--CACHE DUMP----------------------------------------------------\n"); 1325 printf("--CACHE DUMP----------------------------------------------------\n");
1324 printf("cache: %ikb / %ikb\n", 1326 printf("cache: %ikb / %ikb\n",
1325 cache->usage / 1024, 1327 cache->usage / 1024,
@@ -1342,22 +1344,22 @@ EAPI int
1342evas_cache_image_flush(Evas_Cache_Image *cache) 1344evas_cache_image_flush(Evas_Cache_Image *cache)
1343{ 1345{
1344#ifdef CACHEDUMP 1346#ifdef CACHEDUMP
1345 _dump_cache(cache); 1347 _dump_cache(cache);
1346#endif 1348#endif
1347 if (cache->limit == (unsigned int)-1) return -1; 1349 if (cache->limit == (unsigned int)-1) return -1;
1348 1350
1349 while ((cache->lru) && (cache->limit < (unsigned int)cache->usage)) 1351 while ((cache->lru) && (cache->limit < (unsigned int)cache->usage))
1350 { 1352 {
1351 Image_Entry *im; 1353 Image_Entry *im;
1352 1354
1353 im = (Image_Entry *)cache->lru->last; 1355 im = (Image_Entry *)cache->lru->last;
1354 _evas_cache_image_entry_delete(cache, im); 1356 _evas_cache_image_entry_delete(cache, im);
1355 } 1357 }
1356 1358
1357 while ((cache->lru_nodata) && (cache->limit < (unsigned int)cache->usage)) 1359 while ((cache->lru_nodata) && (cache->limit < (unsigned int)cache->usage))
1358 { 1360 {
1359 Image_Entry *im; 1361 Image_Entry *im;
1360 1362
1361 im = (Image_Entry *) cache->lru_nodata->last; 1363 im = (Image_Entry *) cache->lru_nodata->last;
1362 _evas_cache_image_lru_nodata_del(im); 1364 _evas_cache_image_lru_nodata_del(im);
1363 cache->func.surface_delete(im); 1365 cache->func.surface_delete(im);