remove excess tex update on dirty. some formattign and naming too.
authorCarsten Haitzler <raster@rasterman.com>
Sun, 20 Dec 2009 06:23:13 +0000 (06:23 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Sun, 20 Dec 2009 06:23:13 +0000 (06:23 +0000)
SVN revision: 44592

legacy/evas/src/lib/cache/evas_cache_image.c
legacy/evas/src/modules/engines/gl_common/evas_gl_common.h
legacy/evas/src/modules/engines/gl_common/evas_gl_image.c
legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c
legacy/evas/src/modules/engines/gl_x11/evas_engine.c

index 5afe0d7..883c7e0 100644 (file)
@@ -419,15 +419,16 @@ _evas_cache_image_entry_preload_add(Image_Entry *ie,
 
    ie->targets = (Evas_Cache_Target*) eina_inlist_append(EINA_INLIST_GET(ie->targets), EINA_INLIST_GET(tg));
 
-   if (!ie->preload) {
-      ie->cache->preload = eina_list_append(ie->cache->preload, ie);
-      ie->flags.pending = 0;
-
-      ie->preload = evas_preload_thread_run(_evas_cache_image_async_heavy,
-                                           _evas_cache_image_async_end,
-                                           _evas_cache_image_async_cancel,
-                                           ie);
-   }
+   if (!ie->preload)
+     {
+        ie->cache->preload = eina_list_append(ie->cache->preload, ie);
+        ie->flags.pending = 0;
+        
+        ie->preload = evas_preload_thread_run(_evas_cache_image_async_heavy,
+                                              _evas_cache_image_async_end,
+                                              _evas_cache_image_async_cancel,
+                                              ie);
+     }
 
    return 1;
 }
@@ -1164,18 +1165,17 @@ evas_cache_image_preload_data(Image_Entry *im, const void *target)
 
    if (im->flags.loaded)
      {
-       evas_object_inform_call_image_preloaded((Evas_Object*) target);
-       return ;
+       evas_object_inform_call_image_preloaded((Evas_Object *)target);
+       return;
      }
 
    cache = im->cache;
 
    if (!_evas_cache_image_entry_preload_add(im, target))
-     evas_object_inform_call_image_preloaded((Evas_Object*) target);
+     evas_object_inform_call_image_preloaded((Evas_Object *)target);
 #else
    evas_cache_image_load_data(im);
-
-   evas_object_inform_call_image_preloaded((Evas_Object*) target);
+   evas_object_inform_call_image_preloaded((Evas_Object *)target);
 #endif
 }
 
@@ -1183,7 +1183,7 @@ EAPI void
 evas_cache_image_preload_cancel(Image_Entry *im, const void *target)
 {
 #ifdef BUILD_ASYNC_PRELOAD
-   Evas_Cache_Image    *cache;
+   Evas_Cache_Image *cache;
 
    assert(im);
    assert(im->cache);
@@ -1193,7 +1193,7 @@ evas_cache_image_preload_cancel(Image_Entry *im, const void *target)
 
    _evas_cache_image_entry_preload_remove(im, target);
 #else
-   (void) im;
+   (void)im;
 #endif
 }
 
@@ -1202,20 +1202,19 @@ evas_cache_image_flush(Evas_Cache_Image *cache)
 {
    assert(cache);
 
-   if (cache->limit == -1)
-     return -1;
+   if (cache->limit == -1) return -1;
 
    while ((cache->lru) && (cache->limit < cache->usage))
      {
-        Image_Entry     *im;
+        Image_Entry *im;
 
-        im = (Image_Entry *) cache->lru->last;
+        im = (Image_Entry *)cache->lru->last;
         _evas_cache_image_entry_delete(cache, im);
      }
 
    while ((cache->lru_nodata) && (cache->limit < cache->usage))
      {
-        Image_Entry     *im;
+        Image_Entry *im;
 
         im = (Image_Entry *) cache->lru_nodata->last;
         _evas_cache_image_remove_lru_nodata(cache, im);
@@ -1231,14 +1230,13 @@ evas_cache_image_flush(Evas_Cache_Image *cache)
 EAPI Image_Entry *
 evas_cache_image_empty(Evas_Cache_Image *cache)
 {
-   Image_Entry  *new;
-
-   new = _evas_cache_image_entry_new(cache, NULL, 0, NULL, NULL, NULL, NULL);
-   if (!new) return NULL;
+   Image_Entry *im;
 
-   new->references = 1;
+   im = _evas_cache_image_entry_new(cache, NULL, 0, NULL, NULL, NULL, NULL);
+   if (!im) return NULL;
 
-   return new;
+   im->references = 1;
+   return im;
 }
 
 EAPI void
@@ -1251,7 +1249,7 @@ evas_cache_image_colorspace(Image_Entry *im, int cspace)
 
    cache = im->cache;
 
-   if (im->space == cspace) return ;
+   if (im->space == cspace) return;
 
    im->space = cspace;
    cache->func.color_space(im, cspace);
index f8f7777..b497fa9 100644 (file)
@@ -289,7 +289,7 @@ Evas_GL_Image    *evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc,
 Evas_GL_Image    *evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h, int alpha, int cspace);
 void              evas_gl_common_image_free(Evas_GL_Image *im);
 Evas_GL_Image    *evas_gl_common_image_surface_new(Evas_GL_Context *gc, int w, int h, int alpha);
-void              evas_gl_common_image_dirty(Evas_GL_Image *im);
+void              evas_gl_common_image_dirty(Evas_GL_Image *im, int x, int y, int w, int h);
 void              evas_gl_common_image_map4_draw(Evas_GL_Context *gc, Evas_GL_Image *im, RGBA_Map_Point *p, int smooth, int level);
 void              evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth);
 
index 13c2341..05d9ffb 100644 (file)
@@ -208,11 +208,16 @@ evas_gl_common_image_surface_new(Evas_GL_Context *gc, int w, int h, int alpha)
 }
 
 void
-evas_gl_common_image_dirty(Evas_GL_Image *im)
+evas_gl_common_image_dirty(Evas_GL_Image *im, int x, int y, int w, int h)
 {
+   if ((w == 0) && (h == 0) && (x == 0) && (y == 0))
+     {
+        w = im->w;
+        h = im->h;
+     }
    if (im->im)
      {
-        im->im = (RGBA_Image *) evas_cache_image_dirty(&im->im->cache_entry, 0, 0, im->im->cache_entry.w, im->im->cache_entry.h);
+        im->im = (RGBA_Image *)evas_cache_image_dirty(&im->im->cache_entry, x, y, w, h);
      }
    im->dirty = 1;
 }
@@ -249,10 +254,10 @@ _evas_gl_common_image_update(Evas_GL_Context *gc, Evas_GL_Image *im)
        if ((im->tex) && (im->dirty))
          {
             evas_gl_common_texture_update(im->tex, im->im);
-            im->dirty = 0;
          }
        if (!im->tex)
          im->tex = evas_gl_common_texture_new(gc, im->im);
+        im->dirty = 0;
         if (!im->tex) return;
        break;
       case EVAS_COLORSPACE_YCBCR422P601_PL:
index 61a9dbf..6522536 100644 (file)
@@ -334,6 +334,7 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
    glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
 #endif   
    glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+
    //  +-+
    //  +-+
    // 
index b4d4b01..0bda2a1 100644 (file)
@@ -685,7 +685,7 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
         im = im_new;
      }
    else
-     evas_gl_common_image_dirty(im);
+     evas_gl_common_image_dirty(im, 0, 0, 0, 0);
    im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
    return image;
 }
@@ -876,14 +876,14 @@ eng_image_size_set(void *data, void *image, int w, int h)
 }
 
 static void *
-eng_image_dirty_region(void *data, void *image, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
+eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h)
 {
    Render_Engine *re;
 
    re = (Render_Engine *)data;
    if (!image) return NULL;
    eng_window_use(re->win);
-   evas_gl_common_image_dirty(image);
+   evas_gl_common_image_dirty(image, x, y, w, h);
    return image;
 }
 
@@ -923,7 +923,7 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
                  im = im_new;
               }
             else
-              evas_gl_common_image_dirty(im);
+              evas_gl_common_image_dirty(im, 0, 0, 0, 0);
          }
        *image_data = im->im->image.data;
        break;
@@ -981,7 +981,7 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
        break;
      }
    /* hmmm - but if we wrote... why bother? */
-   evas_gl_common_image_dirty(im);
+   evas_gl_common_image_dirty(im, 0, 0, 0, 0);
    return im;
 }