[PATCH weston] compositor: Fix xwayland surface alpha.

Scott Moreau oreaus at gmail.com
Mon Sep 3 08:09:13 PDT 2012


>
>
> NAK, I'm developing a proper fix, that removes
> weston_surface::opaque_rect completely.
>
> Now that we can paint opaque regions independently from non-opaques, we
> can set the shader for opaque regions to the RGBX shader, which forces
> the sampled alpha to 1.0. That way we can keep the shaders simple.
>
>
> Thanks,
> pq
>

Yes, this is the proper fix. It will start something like this, sans the
needed shader usage. Thanks for fixing it up Pekaa.

Scott



diff --git a/src/compositor.c b/src/compositor.c
index 9ce44d4..5e9a0c2 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -243,10 +243,6 @@ weston_surface_create(struct weston_compositor *compositor)

 	surface->compositor = compositor;
 	surface->alpha = 1.0;
-	surface->opaque_rect[0] = 0.0;
-	surface->opaque_rect[1] = 0.0;
-	surface->opaque_rect[2] = 0.0;
-	surface->opaque_rect[3] = 0.0;
 	surface->pitch = 1;

 	surface->num_textures = 0;
diff --git a/src/compositor.h b/src/compositor.h
index 96a0477..38c2657 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -399,7 +399,6 @@ struct weston_surface {
 	struct wl_list layer_link;
 	struct weston_shader *shader;
 	GLfloat color[4];
-	GLfloat opaque_rect[4];
 	GLfloat alpha;
 	struct weston_plane *plane;

diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index e705fec..d960185 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -720,14 +720,8 @@ weston_wm_window_draw_decoration(void *data)
 		/* We leave an extra pixel around the X window area to
 		 * make sure we don't sample from the undefined alpha
 		 * channel when filtering. */
-		window->surface->opaque_rect[0] =
-			(double) (x - 1) / width;
-		window->surface->opaque_rect[1] =
-			(double) (x + window->width + 1) / width;
-		window->surface->opaque_rect[2] =
-			(double) (y - 1) / height;
-		window->surface->opaque_rect[3] =
-			(double) (y + window->height + 1) / height;
+		pixman_region32_init_rect(&window->surface->opaque, x - 1, y - 1,
+					window->width + 1, window->height + 1);

 		pixman_region32_init_rect(&window->surface->input,
 					  t->margin, t->margin,
@@ -743,10 +737,8 @@ weston_wm_window_schedule_repaint(struct
weston_wm_window *window)

 	if (window->frame_id == XCB_WINDOW_NONE) {
 		if (window->surface != NULL) {
-			window->surface->opaque_rect[0] = 0.0;
-			window->surface->opaque_rect[1] = 1.0;
-			window->surface->opaque_rect[2] = 0.0;
-			window->surface->opaque_rect[3] = 1.0;
+			pixman_region32_init_rect(&window->surface->opaque,
+					0, 0, window->width, window->height);
 		}
 		return;
 	}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20120903/9215c309/attachment.html>


More information about the wayland-devel mailing list