From fa9f7a4c892a04b7a2bf7065346124eb9479dab6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 29 Apr 2014 15:33:51 +0900 Subject: [PATCH] Evas: Fix stretching of ETC1/2 textures ETC1/2 textures are (for now) allocated one by one for each image, because we use only glCompressedTexImage (not SubImage). So, the texture height must fit that of its content. This commit bypasses the usual pool allocation logic where textures are rounded up to the next multiple of 16 pixels in height, in case of ETC1/2. --- .../evas/engines/gl_common/evas_gl_texture.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 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 7cc501af5e..993e532ed0 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_texture.c +++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c @@ -282,10 +282,10 @@ evas_gl_common_texture_light_free(Evas_GL_Texture *tex) } static Evas_GL_Texture_Pool * -_pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, GLenum format) +_pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, GLenum intformat, GLenum format) { Evas_GL_Texture_Pool *pt; - Eina_Bool ok; + Eina_Bool ok, no_rounding = EINA_FALSE; if ((w > gc->shared->info.max_texture_size) || (h > gc->shared->info.max_texture_size)) @@ -295,8 +295,17 @@ _pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, GLenum fo } pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); if (!pt) return NULL; - h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; - _tex_adjust(gc, &w, &h); + + if ((intformat == etc1_fmt) || + (intformat == etc2_rgb_fmt) || + (intformat == etc2_rgba_fmt)) + no_rounding = EINA_TRUE; + + if (!no_rounding) + { + h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; + _tex_adjust(gc, &w, &h); + } pt->gc = gc; pt->w = w; pt->h = h;