From 7c7d464ce780e2d19705b2479c3e88d8ba8a09b4 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Tue, 4 Sep 2012 13:55:44 +0300 Subject: [PATCH] compositor: do not round a zero area to non-zero surface_accumulate_damage() will call surface_compute_bbox() with the extents of the surface damage region, for transformed surfaces only. If there is no damage, surface_compute_bbox() will round up the empty rectangle to a 1x1 rectangle. Triangles are produced for this 1x1 rectangle intersected with the surface. The problem showed up with the triangle fan debug, where some seemingly garbage pixels showed up relative to rotated surfaces. Fix this by explicitly checking, that the area, for which a bounding box is being computed for, is not zero. Note, that the bbox will also be empty if only one of width and height is zero. We do not paint things with zero thickness. Signed-off-by: Pekka Paalanen Cc: Rob Clark --- src/compositor.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compositor.c b/src/compositor.c index 868afe9b..2b963f5f 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -347,6 +347,12 @@ surface_compute_bbox(struct weston_surface *surface, int32_t sx, int32_t sy, GLfloat int_x, int_y; int i; + if (width == 0 || height == 0) { + /* avoid rounding empty bbox to 1x1 */ + pixman_region32_init(bbox); + return; + } + for (i = 0; i < 4; ++i) { GLfloat x, y; weston_surface_to_global_float(surface,