Permalink
Browse files

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.
  • Loading branch information...
1 parent 5d965dc commit 9a2ca415156891dea0ea65e383964953fb2a70d4 @soreau committed Aug 18, 2014
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/gl-renderer.c
View
@@ -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);

0 comments on commit 9a2ca41

Please sign in to comment.