compositor: weston_surface_draw() to use bounding box

Use the proper bounding box in clipping the surface repaint area. Fixes
excessive clipping for transformed surfaces.

Also don't leak the region32 on early return.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
dev
Pekka Paalanen 13 years ago
parent 60921e5787
commit a9f8a21c75
  1. 14
      src/compositor.c

@ -666,14 +666,15 @@ weston_surface_draw(struct weston_surface *es, struct weston_output *output)
GLint filter; GLint filter;
int n; int n;
pixman_region32_init_rect(&repaint, weston_surface_update_transform(es);
es->geometry.x, es->geometry.y,
es->geometry.width, es->geometry.height); pixman_region32_init(&repaint);
pixman_region32_intersect(&repaint, &repaint, &output->region); pixman_region32_intersect(&repaint, &es->transform.boundingbox,
&output->region);
pixman_region32_intersect(&repaint, &repaint, &es->damage); pixman_region32_intersect(&repaint, &repaint, &es->damage);
if (!pixman_region32_not_empty(&repaint)) if (!pixman_region32_not_empty(&repaint))
return; goto out;
switch (es->visual) { switch (es->visual) {
case WESTON_ARGB_VISUAL: case WESTON_ARGB_VISUAL:
@ -708,7 +709,6 @@ weston_surface_draw(struct weston_surface *es, struct weston_output *output)
glUniform1f(es->shader->texwidth_uniform, glUniform1f(es->shader->texwidth_uniform,
(GLfloat)es->geometry.width / es->pitch); (GLfloat)es->geometry.width / es->pitch);
weston_surface_update_transform(es);
if (es->transform.enabled) if (es->transform.enabled)
filter = GL_LINEAR; filter = GL_LINEAR;
else else
@ -733,6 +733,8 @@ weston_surface_draw(struct weston_surface *es, struct weston_output *output)
ec->vertices.size = 0; ec->vertices.size = 0;
ec->indices.size = 0; ec->indices.size = 0;
out:
pixman_region32_fini(&repaint); pixman_region32_fini(&repaint);
} }

Loading…
Cancel
Save