xwm: Switch alpha, brightness and saturation to GLfloat

dev
Kristian Høgsberg 13 years ago
parent 579f2934de
commit a416fa15d5
  1. 14
      src/compositor.c
  2. 6
      src/compositor.h
  3. 6
      src/shell.c
  4. 8
      src/util.c

@ -225,9 +225,9 @@ weston_surface_create(struct weston_compositor *compositor)
surface->compositor = compositor; surface->compositor = compositor;
surface->image = EGL_NO_IMAGE_KHR; surface->image = EGL_NO_IMAGE_KHR;
surface->alpha = 255; surface->alpha = 1.0;
surface->brightness = 255; surface->brightness = 1.0;
surface->saturation = 255; surface->saturation = 1.0;
surface->blend = 1; surface->blend = 1;
surface->opaque_rect[0] = 0.0; surface->opaque_rect[0] = 0.0;
surface->opaque_rect[1] = 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.width,
surface->geometry.height); surface->geometry.height);
if (surface->alpha == 255) { if (surface->alpha == 1.0) {
pixman_region32_copy(&surface->transform.opaque, pixman_region32_copy(&surface->transform.opaque,
&surface->opaque); &surface->opaque);
pixman_region32_translate(&surface->transform.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); 1, GL_FALSE, output->matrix.d);
glUniform1i(es->shader->tex_uniform, 0); glUniform1i(es->shader->tex_uniform, 0);
glUniform4fv(es->shader->color_uniform, 1, es->color); glUniform4fv(es->shader->color_uniform, 1, es->color);
glUniform1f(es->shader->alpha_uniform, es->alpha / 255.0); glUniform1f(es->shader->alpha_uniform, es->alpha);
glUniform1f(es->shader->brightness_uniform, es->brightness / 255.0); glUniform1f(es->shader->brightness_uniform, es->brightness);
glUniform1f(es->shader->saturation_uniform, es->saturation / 255.0); glUniform1f(es->shader->saturation_uniform, es->saturation);
glUniform1f(es->shader->texwidth_uniform, glUniform1f(es->shader->texwidth_uniform,
(GLfloat)es->geometry.width / es->pitch); (GLfloat)es->geometry.width / es->pitch);
glUniform4fv(es->shader->opaque_uniform, 1, es->opaque_rect); glUniform4fv(es->shader->opaque_uniform, 1, es->opaque_rect);

@ -333,9 +333,9 @@ struct weston_surface {
struct weston_shader *shader; struct weston_shader *shader;
GLfloat color[4]; GLfloat color[4];
GLfloat opaque_rect[4]; GLfloat opaque_rect[4];
uint32_t alpha; GLfloat alpha;
uint32_t brightness; GLfloat brightness;
uint32_t saturation; GLfloat saturation;
int blend; int blend;
/* Surface geometry state, mutable. /* Surface geometry state, mutable.

@ -2398,11 +2398,11 @@ switcher_next(struct switcher *switcher)
&switcher->listener); &switcher->listener);
switcher->current = next; switcher->current = next;
next->alpha = 255; next->alpha = 1.0;
shsurf = get_shell_surface(switcher->current); shsurf = get_shell_surface(switcher->current);
if (shsurf && shsurf->type ==SHELL_SURFACE_FULLSCREEN) if (shsurf && shsurf->type ==SHELL_SURFACE_FULLSCREEN)
shsurf->fullscreen.black_surface->alpha = 255; shsurf->fullscreen.black_surface->alpha = 1.0;
} }
static void static void
@ -2422,7 +2422,7 @@ switcher_destroy(struct switcher *switcher, uint32_t time)
struct wl_keyboard *keyboard = switcher->grab.keyboard; struct wl_keyboard *keyboard = switcher->grab.keyboard;
wl_list_for_each(surface, &compositor->surface_list, link) { wl_list_for_each(surface, &compositor->surface_list, link) {
surface->alpha = 255; surface->alpha = 1.0;
weston_surface_damage(surface); weston_surface_damage(surface);
} }

@ -153,9 +153,9 @@ weston_zoom_frame(struct weston_animation *animation,
0.5f * es->geometry.width, 0.5f * es->geometry.width,
0.5f * es->geometry.height, 0); 0.5f * es->geometry.height, 0);
es->alpha = zoom->spring.current * 255; es->alpha = zoom->spring.current;
if (es->alpha > 255) if (es->alpha > 1.0)
es->alpha = 255; es->alpha = 1.0;
zoom->surface->geometry.dirty = 1; zoom->surface->geometry.dirty = 1;
weston_compositor_schedule_repaint(es->compositor); weston_compositor_schedule_repaint(es->compositor);
@ -375,7 +375,7 @@ weston_fade_frame(struct weston_animation *animation,
fade_factor = 0; fade_factor = 0;
else else
fade_factor = fade->spring.current; fade_factor = fade->spring.current;
es->alpha = fade_factor * 255; es->alpha = fade_factor;
fade->surface->geometry.dirty = 1; fade->surface->geometry.dirty = 1;
weston_compositor_schedule_repaint(es->compositor); weston_compositor_schedule_repaint(es->compositor);

Loading…
Cancel
Save