and delete u and v textures too
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 10 Oct 2009 14:55:10 +0000 (14:55 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 10 Oct 2009 14:55:10 +0000 (14:55 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@43002 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/engines/gl_common/evas_gl_texture.c

index 3b80cc0..dab86d2 100644 (file)
@@ -273,6 +273,24 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
      }
 }
 
+static void
+pt_unref(Evas_GL_Texture_Pool *pt)
+{
+   pt->references--;
+   if (pt->references > 0) return;
+   if (pt->whole)
+     {
+        pt->gc->tex.whole = eina_list_remove(pt->gc->tex.whole, pt);
+     }
+   else
+     {
+        pt->gc->tex.atlas [pt->slot][pt->fslot] =
+          eina_list_remove(pt->gc->tex.atlas[pt->slot][pt->fslot], pt);
+     }
+   glDeleteTextures(1, &(pt->texture));
+   free(pt);
+}
+
 void
 evas_gl_common_texture_free(Evas_GL_Texture *tex)
 {
@@ -280,26 +298,9 @@ evas_gl_common_texture_free(Evas_GL_Texture *tex)
    tex->references--;
    if (tex->references > 0) return;
    tex->pt->allocations = eina_list_remove(tex->pt->allocations, tex);
-   tex->pt->references--;
-   if (tex->pt->references <= 0)
-     {
-        if (tex->pt->whole)
-          {
-             tex->gc->tex.whole = 
-               eina_list_remove(tex->gc->tex.whole, tex->pt);
-          }
-        else
-          {
-             tex->gc->tex.atlas
-               [tex->pt->slot][tex->pt->fslot] = 
-               eina_list_remove
-               (tex->gc->tex.atlas
-                [tex->pt->slot][tex->pt->fslot],
-                tex->pt);
-          }
-        glDeleteTextures(1, &(tex->pt->texture));
-        free(tex->pt);
-     }
+   pt_unref(tex->pt);
+   if (tex->ptu) pt_unref(tex->ptu);
+   if (tex->ptv) pt_unref(tex->ptv);
    free(tex);
 }