Evas masking: Also fix map masking with non-bgra images

This commit is contained in:
Jean-Philippe Andre 2015-02-06 12:31:24 +09:00
parent 92954b707c
commit 73b16a4962
2 changed files with 8 additions and 5 deletions

View File

@ -2733,7 +2733,7 @@ static const char const map_mask_vert_glsl[] =
"precision highp float;\n"
"#endif\n"
"attribute vec4 vertex, color;\n"
"attribute vec2 tex_coord, tex_coordm, tex_sample;\n"
"attribute vec2 tex_coord, tex_coordm, tex_sample, tex_coorda;\n"
"uniform mat4 mvp;\n"
"varying vec2 tex_c;\n"
"varying vec4 mask_Position, col, mask_Absolute;\n"
@ -2743,7 +2743,7 @@ static const char const map_mask_vert_glsl[] =
" tex_c = tex_coord;\n"
" col = color;\n"
" // Assume Y-invert on mask, normalize (screen to texture mode coordinates)\n"
" mask_Position = mvp * vertex * vec4(0.5, -0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
" mask_Position = mvp * vertex * vec4(0.5, tex_coorda.y * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
" mask_Absolute = vec4(tex_coordm, tex_sample); // x, y, 1/w, 1/h on canvas in GL coords\n"
"}\n";
Evas_GL_Program_Source shader_map_mask_vert_src =

View File

@ -2,7 +2,7 @@
precision highp float;
#endif
attribute vec4 vertex, color;
attribute vec2 tex_coord, tex_coordm, tex_sample;
attribute vec2 tex_coord, tex_coordm, tex_sample, tex_coorda;
uniform mat4 mvp;
varying vec2 tex_c;
varying vec4 mask_Position, col, mask_Absolute;
@ -12,7 +12,10 @@ void main()
tex_c = tex_coord;
col = color;
// Assume Y-invert on mask, normalize (screen to texture mode coordinates)
mask_Position = mvp * vertex * vec4(0.5, -0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
// tex_coorda contains the Y-invert flag
// tex_coordm contains the X,Y position of the mask
// tex_sample contains the W,H size of the mask (inverted)
mask_Position = mvp * vertex * vec4(tex_coorda.x * 0.5, tex_coorda.y * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);
mask_Absolute = vec4(tex_coordm, tex_sample); // x, y, 1/w, 1/h on canvas in GL coords
}