Remove the concept of a border from weston_output.

The only user for this was the wayland backend with the GL renderer.  It is
not needed in the Pixman renderer because you can easily create subimages.
All of the fancy output matrix calculations can be replaced by a single
glViewport call.  Also, it didn't work with outputs located anywhere but
(0, 0) and I'm pretty sure output transformed outputs would break it too.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
dev
Jason Ekstrand 11 years ago committed by Kristian Høgsberg
parent ff2fd46e9c
commit 00b842854b
  1. 10
      src/compositor-wayland.c
  2. 12
      src/compositor.c
  3. 5
      src/compositor.h
  4. 57
      src/gl-renderer.c

@ -570,7 +570,7 @@ static const struct wl_shell_surface_listener shell_surface_listener;
static int
wayland_output_init_gl_renderer(struct wayland_output *output)
{
int32_t fx, fy, fwidth, fheight;
int32_t fwidth = 0, fheight = 0;
if (output->frame) {
fwidth = frame_width(output->frame);
@ -592,14 +592,6 @@ wayland_output_init_gl_renderer(struct wayland_output *output)
output->gl.egl_window) < 0)
goto cleanup_window;
if (output->frame) {
frame_interior(output->frame, &fx, &fy, NULL, NULL);
output->base.border.left = fx;
output->base.border.top = fy;
output->base.border.right = fwidth - output->base.width - fx;
output->base.border.bottom = fheight - output->base.height - fy;
}
return 0;
cleanup_window:

@ -2997,12 +2997,12 @@ weston_output_update_matrix(struct weston_output *output)
weston_matrix_init(&output->matrix);
weston_matrix_translate(&output->matrix,
-(output->x + (output->border.right + output->width - output->border.left) / 2.0),
-(output->y + (output->border.bottom + output->height - output->border.top) / 2.0), 0);
-(output->x + output->width / 2.0),
-(output->y + output->height / 2.0), 0);
weston_matrix_scale(&output->matrix,
2.0 / (output->width + output->border.left + output->border.right),
-2.0 / (output->height + output->border.top + output->border.bottom), 1);
2.0 / output->width,
-2.0 / output->height, 1);
weston_output_compute_transform(output);
@ -3071,10 +3071,6 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c,
output->compositor = c;
output->x = x;
output->y = y;
output->border.top = 0;
output->border.bottom = 0;
output->border.left = 0;
output->border.right = 0;
output->mm_width = mm_width;
output->mm_height = mm_height;
output->dirty = 1;

@ -114,10 +114,6 @@ struct weston_shell_interface {
};
struct weston_border {
int32_t left, right, top, bottom;
};
struct weston_animation {
void (*frame)(struct weston_animation *animation,
struct weston_output *output, uint32_t msecs);
@ -189,7 +185,6 @@ struct weston_output {
struct wl_list animation_list;
int32_t x, y, width, height;
int32_t mm_width, mm_height;
struct weston_border border;
pixman_region32_t region;
pixman_region32_t previous_damage;
int repaint_needed;

@ -664,31 +664,44 @@ draw_output_border(struct weston_output *output)
struct gl_output_state *go = get_output_state(output);
struct gl_renderer *gr = get_renderer(output->compositor);
struct gl_shader *shader = &gr->texture_shader_rgba;
int32_t full_width;
struct gl_border_image *top, *bottom, *left, *right;
struct weston_matrix matrix;
int full_width, full_height;
top = &go->borders[GL_RENDERER_BORDER_TOP];
bottom = &go->borders[GL_RENDERER_BORDER_BOTTOM];
left = &go->borders[GL_RENDERER_BORDER_LEFT];
right = &go->borders[GL_RENDERER_BORDER_RIGHT];
full_width = output->current_mode->width + left->width + right->width;
full_height = output->current_mode->height + top->height + bottom->height;
glDisable(GL_BLEND);
use_shader(gr, shader);
glUniformMatrix4fv(shader->proj_uniform,
1, GL_FALSE, output->matrix.d);
glViewport(0, 0, full_width, full_height);
weston_matrix_init(&matrix);
weston_matrix_translate(&matrix, -full_width/2.0, -full_height/2.0, 0);
weston_matrix_scale(&matrix, 2.0/full_width, -2.0/full_height, 1);
glUniformMatrix4fv(shader->proj_uniform, 1, GL_FALSE, matrix.d);
glUniform1i(shader->tex_uniforms[0], 0);
glUniform1f(shader->alpha_uniform, 1);
glActiveTexture(GL_TEXTURE0);
full_width = output->width + output->border.left + output->border.right;
draw_output_border_texture(&go->borders[GL_RENDERER_BORDER_TOP],
-output->border.left, -output->border.top,
full_width, output->border.top);
draw_output_border_texture(&go->borders[GL_RENDERER_BORDER_LEFT],
-output->border.left, 0,
output->border.left, output->height);
draw_output_border_texture(&go->borders[GL_RENDERER_BORDER_RIGHT],
output->width, 0,
output->border.right, output->height);
draw_output_border_texture(&go->borders[GL_RENDERER_BORDER_BOTTOM],
-output->border.left, output->height,
full_width, output->border.bottom);
draw_output_border_texture(top,
0, 0,
full_width, top->height);
draw_output_border_texture(left,
0, top->height,
left->width, output->current_mode->height);
draw_output_border_texture(right,
full_width - right->width, top->height,
right->width, output->current_mode->height);
draw_output_border_texture(bottom,
0, full_height - bottom->height,
full_width, bottom->height);
}
static void
@ -745,15 +758,13 @@ gl_renderer_repaint_output(struct weston_output *output,
struct gl_renderer *gr = get_renderer(compositor);
EGLBoolean ret;
static int errored;
int32_t width, height;
pixman_region32_t buffer_damage, total_damage;
width = output->current_mode->width +
output->border.left + output->border.right;
height = output->current_mode->height +
output->border.top + output->border.bottom;
glViewport(0, 0, width, height);
/* Calculate the viewport */
glViewport(go->borders[GL_RENDERER_BORDER_LEFT].width,
go->borders[GL_RENDERER_BORDER_BOTTOM].height,
output->current_mode->width,
output->current_mode->height);
if (use_output(output) < 0)
return;

Loading…
Cancel
Save