raster pushed a commit to branch master.

commit 3c891b405897e97c9a99bbcc979da136206cb0a5
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Mon Jul 15 10:59:29 2013 +0900

    evas gl: cover some more cannot-allocate-texture cases.
---
 src/modules/evas/engines/gl_common/evas_gl_font.c    | 1 +
 src/modules/evas/engines/gl_common/evas_gl_image.c   | 3 ++-
 src/modules/evas/engines/gl_common/evas_gl_texture.c | 5 ++++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/evas_gl_font.c 
b/src/modules/evas/engines/gl_common/evas_gl_font.c
index d71c55b..e47c902 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_font.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_font.c
@@ -83,6 +83,7 @@ evas_gl_font_texture_new(void *context, RGBA_Font_Glyph *fg)
 //   fh = h;
    fh = fg->fi->max_h;
    tex = evas_gl_common_texture_alpha_new(gc, ndata, w, h, fh);
+   if (!tex) return NULL;
    tex->sx1 = ((double)(tex->x)) / (double)tex->pt->w;
    tex->sy1 = ((double)(tex->y)) / (double)tex->pt->h;
    tex->sx2 = ((double)(tex->x + tex->w)) / (double)tex->pt->w;
diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c 
b/src/modules/evas/engines/gl_common/evas_gl_image.c
index 5663d77..8874530 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -344,7 +344,7 @@ evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha)
    else
      {
         im->tex = evas_gl_common_texture_new(im->gc, im->im);
-        evas_gl_common_texture_update(im->tex, im->im);
+        if (im->tex) evas_gl_common_texture_update(im->tex, im->im);
      }
    return im;
 }
@@ -673,6 +673,7 @@ evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, 
Evas_GL_Image *im,
    int r, g, b, a;
    int c, cx, cy, cw, ch;
 
+   if (!im->tex) return;
    dc = gc->dc;
 
    if (dc->mul.use)
diff --git a/src/modules/evas/engines/gl_common/evas_gl_texture.c 
b/src/modules/evas/engines/gl_common/evas_gl_texture.c
index d63645d..e254db5 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -327,6 +327,7 @@ _pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h,
        (h > gc->shared->info.tune.atlas.max_h))
      {
         pt = _pool_tex_new(gc, w, h, intformat, format);
+        if (!pt) return NULL;
         gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, pt);
         pt->slot = -1;
         pt->fslot = -1;
@@ -350,6 +351,7 @@ _pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h,
      }
 
    pt = _pool_tex_new(gc, atlas_w, h, intformat, format);
+   if (!pt) return NULL;
    gc->shared->tex.atlas[th][th2] =
      eina_list_prepend(gc->shared->tex.atlas[th][th2], pt);
    pt->slot = th;
@@ -1172,7 +1174,6 @@ evas_gl_common_texture_yuv_new(Evas_Engine_GL_Context 
*gc, DATA8 **rows, unsigne
    tex->ptv = _pool_tex_new(gc,  tex->ptu->w, tex->ptu->h, lum_ifmt, lum_fmt);
    if (!tex->ptv)
      {
-        pt_unref(tex->pt);
         pt_unref(tex->ptu);
         evas_gl_common_texture_light_free(tex);
         return NULL;
@@ -1184,6 +1185,8 @@ evas_gl_common_texture_yuv_new(Evas_Engine_GL_Context 
*gc, DATA8 **rows, unsigne
    tex->pt = _pool_tex_new(gc, tex->ptu->w * 2, tex->ptu->h * 2, lum_ifmt, 
lum_fmt);
    if (!tex->pt)
      {
+        pt_unref(tex->ptu);
+        pt_unref(tex->ptv);
         evas_gl_common_texture_light_free(tex);
         return NULL;
      }

-- 

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk

Reply via email to