Skip to content

Commit

Permalink
gl-renderer: Workaround for opaque region issue
Browse files Browse the repository at this point in the history
In weston, clients can set an opaque region which defines an
area where a black background will be drawn behind a surface.
This is a special case for RGBA textures with bad alpha data.
Wobbly uses an algorithm to define vertices that makes it
difficult to follow this hack. For now, just use the solid
shader if the opaque region is the same as the blend region
and the normal shader otherwise.
  • Loading branch information
soreau committed Aug 18, 2014
1 parent 5d965dc commit 9a2ca41
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/gl-renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,18 @@ draw_view(struct weston_view *ev, struct weston_output *output,
WESTON_PLUGIN_CALL(ec, prepare_paint, ev, ms_elapsed, &needs_paint);

if (!needs_paint) {
if (pixman_region32_not_empty(&surface_blend)) {
use_shader(gr, gs->shader);
glEnable(GL_BLEND);
} else {
use_shader(gr, &gr->texture_shader_rgbx);
shader_uniforms(&gr->texture_shader_rgbx, ev, output);
if (ev->alpha < 1.0)
glEnable(GL_BLEND);
else
glDisable(GL_BLEND);
}

WESTON_PLUGIN_CALL(ec, add_geometry, ev);
WESTON_PLUGIN_CALL(ec, paint_view, ev);
WESTON_PLUGIN_CALL(ec, done_paint, ev);
Expand Down

0 comments on commit 9a2ca41

Please sign in to comment.