From a416fa15d5dfff2f9a10294340400f5a56ac039c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 21 May 2012 14:06:52 -0400 Subject: [PATCH] xwm: Switch alpha, brightness and saturation to GLfloat --- src/compositor.c | 14 +++++++------- src/compositor.h | 6 +++--- src/shell.c | 6 +++--- src/util.c | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index ba201afe..ab4c9706 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -225,9 +225,9 @@ weston_surface_create(struct weston_compositor *compositor) surface->compositor = compositor; surface->image = EGL_NO_IMAGE_KHR; - surface->alpha = 255; - surface->brightness = 255; - surface->saturation = 255; + surface->alpha = 1.0; + surface->brightness = 1.0; + surface->saturation = 1.0; surface->blend = 1; surface->opaque_rect[0] = 0.0; surface->opaque_rect[1] = 0.0; @@ -359,7 +359,7 @@ weston_surface_update_transform_disable(struct weston_surface *surface) surface->geometry.width, surface->geometry.height); - if (surface->alpha == 255) { + if (surface->alpha == 1.0) { pixman_region32_copy(&surface->transform.opaque, &surface->opaque); pixman_region32_translate(&surface->transform.opaque, @@ -868,9 +868,9 @@ weston_surface_draw(struct weston_surface *es, struct weston_output *output, 1, GL_FALSE, output->matrix.d); glUniform1i(es->shader->tex_uniform, 0); glUniform4fv(es->shader->color_uniform, 1, es->color); - glUniform1f(es->shader->alpha_uniform, es->alpha / 255.0); - glUniform1f(es->shader->brightness_uniform, es->brightness / 255.0); - glUniform1f(es->shader->saturation_uniform, es->saturation / 255.0); + glUniform1f(es->shader->alpha_uniform, es->alpha); + glUniform1f(es->shader->brightness_uniform, es->brightness); + glUniform1f(es->shader->saturation_uniform, es->saturation); glUniform1f(es->shader->texwidth_uniform, (GLfloat)es->geometry.width / es->pitch); glUniform4fv(es->shader->opaque_uniform, 1, es->opaque_rect); diff --git a/src/compositor.h b/src/compositor.h index 0ba51d78..32bccd25 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -333,9 +333,9 @@ struct weston_surface { struct weston_shader *shader; GLfloat color[4]; GLfloat opaque_rect[4]; - uint32_t alpha; - uint32_t brightness; - uint32_t saturation; + GLfloat alpha; + GLfloat brightness; + GLfloat saturation; int blend; /* Surface geometry state, mutable. diff --git a/src/shell.c b/src/shell.c index 60f8643d..e23600d6 100644 --- a/src/shell.c +++ b/src/shell.c @@ -2398,11 +2398,11 @@ switcher_next(struct switcher *switcher) &switcher->listener); switcher->current = next; - next->alpha = 255; + next->alpha = 1.0; shsurf = get_shell_surface(switcher->current); if (shsurf && shsurf->type ==SHELL_SURFACE_FULLSCREEN) - shsurf->fullscreen.black_surface->alpha = 255; + shsurf->fullscreen.black_surface->alpha = 1.0; } static void @@ -2422,7 +2422,7 @@ switcher_destroy(struct switcher *switcher, uint32_t time) struct wl_keyboard *keyboard = switcher->grab.keyboard; wl_list_for_each(surface, &compositor->surface_list, link) { - surface->alpha = 255; + surface->alpha = 1.0; weston_surface_damage(surface); } diff --git a/src/util.c b/src/util.c index b06efd08..33dd7dbe 100644 --- a/src/util.c +++ b/src/util.c @@ -153,9 +153,9 @@ weston_zoom_frame(struct weston_animation *animation, 0.5f * es->geometry.width, 0.5f * es->geometry.height, 0); - es->alpha = zoom->spring.current * 255; - if (es->alpha > 255) - es->alpha = 255; + es->alpha = zoom->spring.current; + if (es->alpha > 1.0) + es->alpha = 1.0; zoom->surface->geometry.dirty = 1; weston_compositor_schedule_repaint(es->compositor); @@ -375,7 +375,7 @@ weston_fade_frame(struct weston_animation *animation, fade_factor = 0; else fade_factor = fade->spring.current; - es->alpha = fade_factor * 255; + es->alpha = fade_factor; fade->surface->geometry.dirty = 1; weston_compositor_schedule_repaint(es->compositor);