From 396433bbc27819e6205db0d2cc8dcddf10d1dd46 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Sat, 16 Aug 2014 15:06:24 +0200 Subject: [PATCH] evas: handle GL_LUMINANCE_ALPHA. This fix T1459. I have added an ERR to catch this kind of issue earlier. I am wondering if that should not be even a CRI. The reason why we do see the problem only after the introduction of the use of Eina_Rectangle_Pool is due to how efficiently they pack data, resulting in ressource ending up in the wrong format bucket. Nothing wrong with the patch itself. --- src/modules/evas/engines/gl_common/evas_gl_texture.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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 f3e2ab9..07f463c 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_texture.c +++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c @@ -235,14 +235,15 @@ _tex_format_index(GLuint format) case GL_LUMINANCE12: case GL_LUMINANCE16: return 10; + case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE8_ALPHA8: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: return 11; default: - // abort? - return 0; + ERR("Unknown format returned specified by GL stack: %x", format); + return -1; } return 0; } @@ -465,14 +466,13 @@ _pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h, } th2 = _tex_format_index(intformat); + if (th2 < 0) return NULL; EINA_LIST_FOREACH(gc->shared->tex.atlas[th2], l, pt) { if ((*apt = _pool_tex_alloc(pt, w, h, u, v)) != NULL) { gc->shared->tex.atlas[th2] = - eina_list_remove_list(gc->shared->tex.atlas[th2], l); - gc->shared->tex.atlas[th2] = - eina_list_prepend(gc->shared->tex.atlas[th2], pt); + eina_list_promote_list(gc->shared->tex.atlas[th2], l); return pt; } } @@ -483,7 +483,6 @@ _pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h, pool_h = gc->shared->info.tune.atlas.max_h; } pt = _pool_tex_new(gc, atlas_w, pool_h, intformat, format); - if (!pt) return NULL; gc->shared->tex.atlas[th2] = eina_list_prepend(gc->shared->tex.atlas[th2], pt); -- 2.7.4