xwm: Switch alpha, brightness and saturation to GLfloat
authorKristian Høgsberg <krh@bitplanet.net>
Mon, 21 May 2012 18:06:52 +0000 (14:06 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 21 May 2012 21:03:06 +0000 (17:03 -0400)
src/compositor.c
src/compositor.h
src/shell.c
src/util.c

index ba201af..ab4c970 100644 (file)
@@ -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);
index 0ba51d7..32bccd2 100644 (file)
@@ -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.
index 60f8643..e23600d 100644 (file)
@@ -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);
        }
 
index b06efd0..33dd7db 100644 (file)
@@ -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);