compositor: Get rid of surface->visual

dev
Kristian Høgsberg 13 years ago
parent 6a8b553119
commit 101cb6560c
  1. 7
      src/compositor-drm.c
  2. 49
      src/compositor.c
  3. 7
      src/compositor.h

@ -96,8 +96,11 @@ drm_output_prepare_scanout_surface(struct drm_output *output)
es = container_of(c->base.surface_list.next, es = container_of(c->base.surface_list.next,
struct weston_surface, link); struct weston_surface, link);
if (es->visual != WESTON_RGB_VISUAL || /* Need to verify output->region contained in surface opaque
es->geometry.x != output->base.x || * region. Or maybe just that format doesn't have alpha. */
return -1;
if (es->geometry.x != output->base.x ||
es->geometry.y != output->base.y || es->geometry.y != output->base.y ||
es->geometry.width != output->base.current->width || es->geometry.width != output->base.current->width ||
es->geometry.height != output->base.current->height || es->geometry.height != output->base.current->height ||

@ -190,7 +190,6 @@ weston_surface_create(struct weston_compositor *compositor)
surface->surface.resource.client = NULL; surface->surface.resource.client = NULL;
surface->compositor = compositor; surface->compositor = compositor;
surface->visual = WESTON_NONE_VISUAL;
surface->image = EGL_NO_IMAGE_KHR; surface->image = EGL_NO_IMAGE_KHR;
surface->alpha = 255; surface->alpha = 255;
@ -218,11 +217,6 @@ static void
weston_surface_set_color(struct weston_surface *surface, weston_surface_set_color(struct weston_surface *surface,
GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
{ {
if (alpha == 1)
surface->visual = WESTON_RGB_VISUAL;
else
surface->visual = WESTON_ARGB_VISUAL;
surface->color[0] = red; surface->color[0] = red;
surface->color[1] = green; surface->color[1] = green;
surface->color[2] = blue; surface->color[2] = blue;
@ -380,18 +374,6 @@ weston_surface_update_transform(struct weston_surface *surface)
pixman_region32_union(&surface->damage, &surface->damage, pixman_region32_union(&surface->damage, &surface->damage,
&surface->transform.boundingbox); &surface->transform.boundingbox);
pixman_region32_fini(&surface->transform.opaque);
if (surface->visual == WESTON_RGB_VISUAL &&
surface->transform.enabled == 0)
pixman_region32_init_rect(&surface->transform.opaque,
surface->geometry.x,
surface->geometry.y,
surface->geometry.width,
surface->geometry.height);
else
pixman_region32_init(&surface->transform.opaque);
if (surface->output) if (surface->output)
weston_surface_assign_output(surface); weston_surface_assign_output(surface);
@ -654,15 +636,6 @@ weston_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface)
GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_BGRA_EXT, GL_UNSIGNED_BYTE,
wl_shm_buffer_get_data(buffer)); wl_shm_buffer_get_data(buffer));
switch (wl_shm_buffer_get_format(buffer)) {
case WL_SHM_FORMAT_ARGB8888:
es->visual = WESTON_ARGB_VISUAL;
break;
case WL_SHM_FORMAT_XRGB8888:
es->visual = WESTON_RGB_VISUAL;
break;
}
surfaces_attached_to = buffer->user_data; surfaces_attached_to = buffer->user_data;
wl_list_remove(&es->buffer_link); wl_list_remove(&es->buffer_link);
@ -676,7 +649,6 @@ weston_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface)
ec->image_target_texture_2d(GL_TEXTURE_2D, es->image); ec->image_target_texture_2d(GL_TEXTURE_2D, es->image);
es->visual = WESTON_ARGB_VISUAL;
es->pitch = es->geometry.width; es->pitch = es->geometry.width;
} }
} }
@ -757,18 +729,8 @@ weston_surface_draw(struct weston_surface *es, struct weston_output *output)
if (!pixman_region32_not_empty(&repaint)) if (!pixman_region32_not_empty(&repaint))
goto out; goto out;
switch (es->visual) { glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
case WESTON_ARGB_VISUAL: glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
break;
case WESTON_RGB_VISUAL:
glDisable(GL_BLEND);
break;
default:
fprintf(stderr, "bogus visual\n");
break;
}
if (ec->current_shader != es->shader) { if (ec->current_shader != es->shader) {
glUseProgram(es->shader->program); glUseProgram(es->shader->program);
@ -1154,7 +1116,7 @@ surface_attach(struct wl_client *client,
{ {
struct weston_surface *es = resource->data; struct weston_surface *es = resource->data;
struct weston_shell *shell = es->compositor->shell; struct weston_shell *shell = es->compositor->shell;
struct wl_buffer *buffer; struct wl_buffer *buffer, *prev;
if (!buffer_resource && !es->output) if (!buffer_resource && !es->output)
return; return;
@ -1168,7 +1130,6 @@ surface_attach(struct wl_client *client,
if (!buffer_resource && es->output) { if (!buffer_resource && es->output) {
wl_list_remove(&es->link); wl_list_remove(&es->link);
es->visual = WESTON_NONE_VISUAL;
es->output = NULL; es->output = NULL;
es->buffer = NULL; es->buffer = NULL;
return; return;
@ -1176,11 +1137,12 @@ surface_attach(struct wl_client *client,
buffer = buffer_resource->data; buffer = buffer_resource->data;
buffer->busy_count++; buffer->busy_count++;
prev = es->buffer;
es->buffer = buffer; es->buffer = buffer;
wl_list_insert(es->buffer->resource.destroy_listener_list.prev, wl_list_insert(es->buffer->resource.destroy_listener_list.prev,
&es->buffer_destroy_listener.link); &es->buffer_destroy_listener.link);
if (es->visual == WESTON_NONE_VISUAL) { if (prev == NULL) {
shell->map(shell, es, buffer->width, buffer->height, sx, sy); shell->map(shell, es, buffer->width, buffer->height, sx, sy);
} else if (sx != 0 || sy != 0 || } else if (sx != 0 || sy != 0 ||
es->geometry.width != buffer->width || es->geometry.width != buffer->width ||
@ -1727,7 +1689,6 @@ input_device_attach(struct wl_client *client,
if (!buffer_resource && device->sprite->output) { if (!buffer_resource && device->sprite->output) {
wl_list_remove(&device->sprite->link); wl_list_remove(&device->sprite->link);
device->sprite->visual = WESTON_NONE_VISUAL;
device->sprite->output = NULL; device->sprite->output = NULL;
return; return;
} }

@ -96,12 +96,6 @@ struct weston_input_device {
struct wl_listener touch_focus_resource_listener; struct wl_listener touch_focus_resource_listener;
}; };
enum weston_visual {
WESTON_NONE_VISUAL,
WESTON_ARGB_VISUAL,
WESTON_RGB_VISUAL
};
struct weston_shader { struct weston_shader {
GLuint program; GLuint program;
GLuint vertex_shader, fragment_shader; GLuint vertex_shader, fragment_shader;
@ -250,7 +244,6 @@ struct weston_surface {
struct weston_shader *shader; struct weston_shader *shader;
GLfloat color[4]; GLfloat color[4];
uint32_t alpha; uint32_t alpha;
uint32_t visual;
int overlapped; int overlapped;
int pickable; int pickable;

Loading…
Cancel
Save