|
|
@ -226,6 +226,8 @@ weston_surface_create(struct weston_compositor *compositor) |
|
|
|
surface->compositor = compositor; |
|
|
|
surface->compositor = compositor; |
|
|
|
surface->image = EGL_NO_IMAGE_KHR; |
|
|
|
surface->image = EGL_NO_IMAGE_KHR; |
|
|
|
surface->alpha = 255; |
|
|
|
surface->alpha = 255; |
|
|
|
|
|
|
|
surface->brightness = 255; |
|
|
|
|
|
|
|
surface->saturation = 255; |
|
|
|
surface->pitch = 1; |
|
|
|
surface->pitch = 1; |
|
|
|
|
|
|
|
|
|
|
|
surface->buffer = NULL; |
|
|
|
surface->buffer = NULL; |
|
|
@ -822,6 +824,8 @@ weston_surface_draw(struct weston_surface *es, struct weston_output *output, |
|
|
|
glUniform1i(es->shader->tex_uniform, 0); |
|
|
|
glUniform1i(es->shader->tex_uniform, 0); |
|
|
|
glUniform4fv(es->shader->color_uniform, 1, es->color); |
|
|
|
glUniform4fv(es->shader->color_uniform, 1, es->color); |
|
|
|
glUniform1f(es->shader->alpha_uniform, es->alpha / 255.0); |
|
|
|
glUniform1f(es->shader->alpha_uniform, es->alpha / 255.0); |
|
|
|
|
|
|
|
glUniform1f(es->shader->brightness_uniform, es->brightness / 255.0); |
|
|
|
|
|
|
|
glUniform1f(es->shader->saturation_uniform, es->saturation / 255.0); |
|
|
|
glUniform1f(es->shader->texwidth_uniform, |
|
|
|
glUniform1f(es->shader->texwidth_uniform, |
|
|
|
(GLfloat)es->geometry.width / es->pitch); |
|
|
|
(GLfloat)es->geometry.width / es->pitch); |
|
|
|
|
|
|
|
|
|
|
@ -2185,6 +2189,8 @@ static const char texture_fragment_shader[] = |
|
|
|
"varying vec2 v_texcoord;\n" |
|
|
|
"varying vec2 v_texcoord;\n" |
|
|
|
"uniform sampler2D tex;\n" |
|
|
|
"uniform sampler2D tex;\n" |
|
|
|
"uniform float alpha;\n" |
|
|
|
"uniform float alpha;\n" |
|
|
|
|
|
|
|
"uniform float bright;\n" |
|
|
|
|
|
|
|
"uniform float saturation;\n" |
|
|
|
"uniform float texwidth;\n" |
|
|
|
"uniform float texwidth;\n" |
|
|
|
"void main()\n" |
|
|
|
"void main()\n" |
|
|
|
"{\n" |
|
|
|
"{\n" |
|
|
@ -2192,6 +2198,10 @@ static const char texture_fragment_shader[] = |
|
|
|
" v_texcoord.y < 0.0 || v_texcoord.y > 1.0)\n" |
|
|
|
" v_texcoord.y < 0.0 || v_texcoord.y > 1.0)\n" |
|
|
|
" discard;\n" |
|
|
|
" discard;\n" |
|
|
|
" gl_FragColor = texture2D(tex, v_texcoord)\n;" |
|
|
|
" gl_FragColor = texture2D(tex, v_texcoord)\n;" |
|
|
|
|
|
|
|
" float gray = dot(gl_FragColor.rgb, vec3(0.299, 0.587, 0.114));\n" |
|
|
|
|
|
|
|
" vec3 range = (gl_FragColor.rgb - vec3 (gray, gray, gray)) * saturation;\n" |
|
|
|
|
|
|
|
" gl_FragColor = vec4(vec3(gray + range), gl_FragColor.a);\n" |
|
|
|
|
|
|
|
" gl_FragColor = vec4(vec3(bright, bright, bright) * gl_FragColor.rgb, gl_FragColor.a);\n" |
|
|
|
" gl_FragColor = alpha * gl_FragColor;\n" |
|
|
|
" gl_FragColor = alpha * gl_FragColor;\n" |
|
|
|
"}\n"; |
|
|
|
"}\n"; |
|
|
|
|
|
|
|
|
|
|
@ -2253,6 +2263,8 @@ weston_shader_init(struct weston_shader *shader, |
|
|
|
shader->proj_uniform = glGetUniformLocation(shader->program, "proj"); |
|
|
|
shader->proj_uniform = glGetUniformLocation(shader->program, "proj"); |
|
|
|
shader->tex_uniform = glGetUniformLocation(shader->program, "tex"); |
|
|
|
shader->tex_uniform = glGetUniformLocation(shader->program, "tex"); |
|
|
|
shader->alpha_uniform = glGetUniformLocation(shader->program, "alpha"); |
|
|
|
shader->alpha_uniform = glGetUniformLocation(shader->program, "alpha"); |
|
|
|
|
|
|
|
shader->brightness_uniform = glGetUniformLocation(shader->program, "bright"); |
|
|
|
|
|
|
|
shader->saturation_uniform = glGetUniformLocation(shader->program, "saturation"); |
|
|
|
shader->color_uniform = glGetUniformLocation(shader->program, "color"); |
|
|
|
shader->color_uniform = glGetUniformLocation(shader->program, "color"); |
|
|
|
shader->texwidth_uniform = glGetUniformLocation(shader->program, |
|
|
|
shader->texwidth_uniform = glGetUniformLocation(shader->program, |
|
|
|
"texwidth"); |
|
|
|
"texwidth"); |
|
|
|