summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-05-17 11:11:15 -0400
committerKristian Høgsberg <krh@bitplanet.net>2012-05-17 11:11:15 -0400
commitd6ad122d9ac8856aa6d35cc690550c857caa5212 (patch)
tree7b8515923686b8aae4e66b7b05057c74c11886b7
parentc0bc844094bf239a373171dc18c018ac5c1252c7 (diff)
compositor: Disable blending for WL_SHM_FORMAT_XRGB8888 surface
Will it blend? No.
-rw-r--r--src/compositor.c10
-rw-r--r--src/compositor.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 313eb67..8fd4aa6 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -228,6 +228,7 @@ weston_surface_create(struct weston_compositor *compositor)
surface->alpha = 255;
surface->brightness = 255;
surface->saturation = 255;
+ surface->blend = 1;
surface->opaque_rect[0] = 0.0;
surface->opaque_rect[1] = 0.0;
surface->opaque_rect[2] = 0.0;
@@ -761,6 +762,10 @@ weston_surface_attach(struct wl_surface *surface, struct wl_buffer *buffer)
glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT,
es->pitch, es->buffer->height, 0,
GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
+ if (wl_shm_buffer_get_format(buffer) == WL_SHM_FORMAT_XRGB8888)
+ es->blend = 0;
+ else
+ es->blend = 1;
} else {
if (es->image != EGL_NO_IMAGE_KHR)
ec->destroy_image(ec->display, es->image);
@@ -849,7 +854,10 @@ weston_surface_draw(struct weston_surface *es, struct weston_output *output,
goto out;
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ if (es->blend)
+ glEnable(GL_BLEND);
+ else
+ glDisable(GL_BLEND);
if (ec->current_shader != es->shader) {
glUseProgram(es->shader->program);
diff --git a/src/compositor.h b/src/compositor.h
index e8edbb4..de30647 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -331,6 +331,7 @@ struct weston_surface {
uint32_t alpha;
uint32_t brightness;
uint32_t saturation;
+ int blend;
/* Surface geometry state, mutable.
* If you change anything, set dirty = 1.