fix load opts to only unload/reload if opts changed for cserve
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 10 May 2009 03:06:49 +0000 (03:06 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 10 May 2009 03:06:49 +0000 (03:06 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@40573 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/evas_cserve_main.c
src/lib/cache/evas_cache_image.c
src/lib/canvas/evas_object_image.c
src/lib/engines/common/evas_image_scalecache.c

index 264c71e..c7e3a38 100644 (file)
@@ -455,7 +455,6 @@ img_new(const char *file, const char *key, RGBA_Image_Loadopts *load_opts, const
    img->image.alpha = ie->flags.alpha;
    img->ref = 1;
    img->active = 1;
-
    img->usage = sizeof(Img) + strlen(img->key) + 1 + 
      strlen(img->file.file) + 1;
    if (img->file.key) img->usage += strlen(img->file.key) + 1;
index 3c304fe..22a4ad0 100644 (file)
@@ -676,7 +676,6 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
 
         ok = 1;
         t = time(NULL);
-
         if ((t - im->laststat) > STAT_GAP)
           {
              stat_done = 1;
@@ -730,8 +729,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
      }
 
    im = _evas_cache_image_entry_new(cache, hkey, st.st_mtime, file, key, lo, error);
-   if (!im)
-     return NULL;
+   if (!im) return NULL;
 
    if (cache->func.debug)
      cache->func.debug("request", im);
@@ -814,6 +812,18 @@ evas_cache_image_dirty(Image_Entry *im, int x, int y, int w, int h)
           {
              int        error;
 
+             im_dirty = evas_cache_image_copied_data
+               (cache, im->w, im->h, 
+                evas_cache_image_pixels(im), 
+                im->flags.alpha, 
+                im->space);
+             if (!im_dirty) goto on_error;
+             if (cache->func.debug)
+               cache->func.debug("dirty-src", im);
+             error = cache->func.dirty(im_dirty, im);
+             if (cache->func.debug)
+               cache->func.debug("dirty-out", im_dirty);
+/*             
              im_dirty = _evas_cache_image_entry_new(cache, NULL, im->timestamp, im->file, im->key, &im->load_opts, &error);
              if (!im_dirty) goto on_error;
 
@@ -824,7 +834,7 @@ evas_cache_image_dirty(Image_Entry *im, int x, int y, int w, int h)
                cache->func.debug("dirty-out", im_dirty);
 
              if (error != 0) goto on_error;
-
+ */
              im_dirty->references = 1;
 
              evas_cache_image_drop(im);
@@ -869,6 +879,18 @@ evas_cache_image_alone(Image_Entry *im)
      {
         int     error;
 
+        im_dirty = evas_cache_image_copied_data
+          (cache, im->w, im->h, 
+           evas_cache_image_pixels(im), 
+           im->flags.alpha, 
+           im->space);
+        if (!im_dirty) goto on_error;
+        if (cache->func.debug)
+          cache->func.debug("dirty-src", im);
+        error = cache->func.dirty(im_dirty, im);
+        if (cache->func.debug)
+          cache->func.debug("dirty-out", im_dirty);
+/*        
         im_dirty = _evas_cache_image_entry_new(cache, NULL, im->timestamp, im->file, im->key, &im->load_opts, &error);
         if (!im_dirty) goto on_error;
 
@@ -879,7 +901,7 @@ evas_cache_image_alone(Image_Entry *im)
           cache->func.debug("dirty-out", im_dirty);
 
         if (error != 0) goto on_error;
-
+ */
         im_dirty->references = 1;
 
         evas_cache_image_drop(im);
index e7a1923..9c8b8b6 100644 (file)
@@ -1588,6 +1588,7 @@ evas_object_image_load_dpi_set(Evas_Object *obj, double dpi)
    MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
    return;
    MAGIC_CHECK_END();
+   if (dpi == o->load_opts.dpi) return;
    o->load_opts.dpi = dpi;
    if (o->cur.file)
      {
@@ -1637,6 +1638,7 @@ evas_object_image_load_size_set(Evas_Object *obj, int w, int h)
    MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
    return;
    MAGIC_CHECK_END();
+   if ((o->load_opts.w == w) && (o->load_opts.h == h)) return;
    o->load_opts.w = w;
    o->load_opts.h = h;
    if (o->cur.file)
@@ -1682,6 +1684,7 @@ evas_object_image_load_scale_down_set(Evas_Object *obj, int scale_down)
    MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
    return;
    MAGIC_CHECK_END();
+   if (o->load_opts.scale_down_by == scale_down) return;
    o->load_opts.scale_down_by = scale_down;
    if (o->cur.file)
      {
index dcb3d6a..53e2af1 100644 (file)
@@ -246,6 +246,8 @@ _sci_find(RGBA_Image *im,
    sci->usage = 0;
    sci->usage_count = 0;
    sci->populate_me = 0;
+   sci->smooth = smooth;
+   sci->forced_unload = 0;
    sci->flop = 0;
    sci->im = NULL;
    sci->src_x = src_region_x;
@@ -254,7 +256,6 @@ _sci_find(RGBA_Image *im,
    sci->src_h = src_region_h;
    sci->dst_w = dst_region_w;
    sci->dst_h = dst_region_h;
-   sci->smooth = smooth;
    im->cache.list = eina_list_prepend(im->cache.list, sci);
    return sci;
 }
@@ -299,6 +300,7 @@ _cache_prune(Scaleitem *notsci, Evas_Bool copies_only)
 EAPI void
 evas_common_rgba_image_scalecache_size_set(int size)
 {
+#ifdef SCALECACHE
    LKL(cache_lock);
    if (size != max_cache_size)
      {
@@ -306,21 +308,27 @@ evas_common_rgba_image_scalecache_size_set(int size)
         _cache_prune(NULL, 1);
      }
    LKU(cache_lock);
+#endif   
 }
 
 EAPI int
 evas_common_rgba_image_scalecache_size_get(void)
 {
+#ifdef SCALECACHE
    int t;
    LKL(cache_lock);
    t = max_cache_size;
    LKU(cache_lock);
    return t;
+#else
+   return 0;
+#endif   
 }
 
 EAPI void
 evas_common_rgba_image_scalecache_flush(void)
 {
+#ifdef SCALECACHE
    int t;
    LKL(cache_lock);
    t = max_cache_size;
@@ -328,6 +336,7 @@ evas_common_rgba_image_scalecache_flush(void)
    _cache_prune(NULL, 1);
    max_cache_size = t;
    LKU(cache_lock);
+#endif   
 }
 
 EAPI void