Evas masking: Force BLEND mode in case of image masking (GL)
authorJean-Philippe Andre <jp.andre@samsung.com>
Tue, 10 Feb 2015 09:18:05 +0000 (18:18 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 10 Feb 2015 09:18:05 +0000 (18:18 +0900)
This fixes some cases where the image has no alpha and COPY mode
is used, but a mask is also applied. In that case, masking
takes precedence and BLEND mode is used.

@fix

src/modules/evas/engines/gl_common/evas_gl_context.c

index bed567c..080ae2a 100644 (file)
@@ -1850,10 +1850,16 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
    Eina_Bool blend = EINA_FALSE;
    Evas_GL_Shader shader = SHADER_IMG;
    GLuint prog = gc->shared->shader[shader].prog;
-   int pn = 0, sam = 0;
+   int pn = 0, sam = 0, render_op = gc->dc->render_op;
 
-   if (!(gc->dc->render_op == EVAS_RENDER_COPY) &&
-       ((a < 255) || (tex->alpha) || (!!mtex))) blend = EINA_TRUE;
+   if (!!mtex)
+     {
+        // masking forces BLEND mode (mask with COPY does not make sense)
+        blend = EINA_TRUE;
+        render_op = EVAS_RENDER_BLEND;
+     }
+   else if (!(render_op == EVAS_RENDER_COPY) && ((a < 255) || (tex->alpha)))
+     blend = EINA_TRUE;
 
    if (tex_only)
      {
@@ -2050,7 +2056,7 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
    gc->pipe[pn].shader.cur_prog = prog;
    gc->pipe[pn].shader.smooth = smooth;
    gc->pipe[pn].shader.blend = blend;
-   gc->pipe[pn].shader.render_op = gc->dc->render_op;
+   gc->pipe[pn].shader.render_op = render_op;
    gc->pipe[pn].shader.clip = 0;
    gc->pipe[pn].shader.cx = 0;
    gc->pipe[pn].shader.cy = 0;