From bee4e5f47692b2c32f5e071b57651e298bb78516 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Wed, 20 Jan 2016 17:28:49 +0900 Subject: [PATCH] Evas: Actually fix this 'afill' thing This mostly reverts 448720fed4da252fa5eefa02ae37c79c5fb63499 After my previous patch, semi-transparent windows would render incorrectly in E. The AFILL flag should make sure the source texture is "opaque" (ie. if it's not marked as having an alpha channel), and masking or color multiply should then be applied later on. Sorry for the mess... --- src/modules/evas/engines/gl_common/evas_gl_shader.c | 13 ++++--------- .../evas/engines/gl_common/shader/evas_gl_shaders.x | 6 +++--- .../evas/engines/gl_common/shader/fragment.glsl | 8 ++++---- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/modules/evas/engines/gl_common/evas_gl_shader.c b/src/modules/evas/engines/gl_common/evas_gl_shader.c index 0590e17a17..c049d9e609 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_shader.c +++ b/src/modules/evas/engines/gl_common/evas_gl_shader.c @@ -646,7 +646,7 @@ evas_gl_common_shader_flags_get(Evas_GL_Shared *shared, Shader_Type type, Shader_Sampling *psam, int *pnomul, Shader_Sampling *pmasksam) { Shader_Sampling sam = SHD_SAM11, masksam = SHD_SAM11; - int nomul = 1, bgra = 0, k, noalpha = 1; + int nomul = 1, bgra = 0, k; unsigned int flags = BASEFLAG; // image downscale sampling @@ -717,17 +717,12 @@ evas_gl_common_shader_flags_get(Evas_GL_Shared *shared, Shader_Type type, if (map_points[k].col != 0xffffffff) { nomul = 0; - if (A_VAL(&map_points[k].col) < 255) - noalpha = 0; + break; } } } else - { - if (a < 255) - noalpha = 0; - nomul = 0; - } + nomul = 0; if (nomul) flags |= SHADER_FLAG_NOMUL; @@ -746,7 +741,7 @@ evas_gl_common_shader_flags_get(Evas_GL_Shared *shared, Shader_Type type, if (tex) { flags |= SHADER_FLAG_TEX; - if (!tex->alpha && !mtex && noalpha) + if (!tex->alpha) flags |= SHADER_FLAG_AFILL; } diff --git a/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x b/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x index a0132aa79a..558531a50b 100644 --- a/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x +++ b/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x @@ -146,6 +146,9 @@ static const char fragment_glsl[] = " ma = texture2D(texm, tex_m).a;\n" "# endif\n" "#endif\n" + "#ifdef SHD_AFILL\n" + " c.a = 1.0;\n" + "#endif\n" " gl_FragColor =\n" " c\n" "#ifndef SHD_NOMUL\n" @@ -158,9 +161,6 @@ static const char fragment_glsl[] = " * texture2D(texa, tex_a).r\n" "#endif\n" " ;\n" - "#ifdef SHD_AFILL\n" - " gl_FragColor.a = 1.0;\n" - "#endif\n" "}\n"; static const char vertex_glsl[] = diff --git a/src/modules/evas/engines/gl_common/shader/fragment.glsl b/src/modules/evas/engines/gl_common/shader/fragment.glsl index baa22e3350..b534961300 100644 --- a/src/modules/evas/engines/gl_common/shader/fragment.glsl +++ b/src/modules/evas/engines/gl_common/shader/fragment.glsl @@ -148,6 +148,10 @@ void main() # endif #endif +#ifdef SHD_AFILL + c.a = 1.0; +#endif + gl_FragColor = c #ifndef SHD_NOMUL @@ -160,9 +164,5 @@ void main() * texture2D(texa, tex_a).r #endif ; - -#ifdef SHD_AFILL - gl_FragColor.a = 1.0; -#endif }