Evas: Fix bug in evas_cache_image_dirty() 29/52229/1
authorJoogab Yun <joogab.yun@samsung.com>
Fri, 20 Nov 2015 05:37:52 +0000 (14:37 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Fri, 20 Nov 2015 05:37:52 +0000 (14:37 +0900)
Summary: Code which shouldn't be removed was removed by '800279c23bdb0e925f112c96516dcc96a5487684'

Reviewers: spacegrapher, cedric, jpeg

Reviewed By: jpeg

Subscribers: scholb.kim, dkdk, wonsik, cedric

Differential Revision: https://phab.enlightenment.org/D3278

Change-Id: I9ba30148010eed084a92e32c292504dba5337036

src/lib/evas/cache/evas_cache_image.c

index 6220fbc..f6fd2a7 100644 (file)
@@ -973,16 +973,20 @@ evas_cache_image_dirty(Image_Entry *im, unsigned int x, unsigned int y, unsigned
    cache = im->cache;
    if (!(im->flags.dirty))
      {
-        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);
-        cache->func.dirty(im_dirty, im);
-        if (cache->func.debug) cache->func.debug("dirty-out", im_dirty);
-        im_dirty->references = 1;
-        evas_cache_image_drop(im);
+        if (im->references == 1) im_dirty = im;
+        else
+          {
+             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);
+             cache->func.dirty(im_dirty, im);
+             if (cache->func.debug) cache->func.debug("dirty-out", im_dirty);
+             im_dirty->references = 1;
+             evas_cache_image_drop(im);
+          }
         _evas_cache_image_dirty_add(im_dirty);
      }