Skip to content

Commit 9a2ca41

Browse files
committed
gl-renderer: Workaround for opaque region issue
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.
1 parent 5d965dc commit 9a2ca41

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/gl-renderer.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,18 @@ draw_view(struct weston_view *ev, struct weston_output *output,
436436
WESTON_PLUGIN_CALL(ec, prepare_paint, ev, ms_elapsed, &needs_paint);
437437

438438
if (!needs_paint) {
439+
if (pixman_region32_not_empty(&surface_blend)) {
440+
use_shader(gr, gs->shader);
441+
glEnable(GL_BLEND);
442+
} else {
443+
use_shader(gr, &gr->texture_shader_rgbx);
444+
shader_uniforms(&gr->texture_shader_rgbx, ev, output);
445+
if (ev->alpha < 1.0)
446+
glEnable(GL_BLEND);
447+
else
448+
glDisable(GL_BLEND);
449+
}
450+
439451
WESTON_PLUGIN_CALL(ec, add_geometry, ev);
440452
WESTON_PLUGIN_CALL(ec, paint_view, ev);
441453
WESTON_PLUGIN_CALL(ec, done_paint, ev);

0 commit comments

Comments
 (0)