compositor: clarify update_transform vs. repaint
authorPekka Paalanen <ppaalanen@gmail.com>
Thu, 9 Feb 2012 13:58:44 +0000 (15:58 +0200)
committerPekka Paalanen <ppaalanen@gmail.com>
Fri, 10 Feb 2012 13:47:56 +0000 (15:47 +0200)
Remove redundant weston_surface_update_transform() calls from within
output repaint paths, and add a comment that we need to rely on
surface->geometry.dirty == 0 within the repaint sub-functions.

Now that weston_surface_update_transform() does damage as needed, and
weston_output_repaint() explicitly calls update_transform, we can reduce
the updates in rotate_grab_motion() to simply scheduling a repaint. This
will guarantee that the change in rotation ends up on screen ASAP.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
src/compositor.c
src/shell.c

index 5baf50a..67bf778 100644 (file)
@@ -716,8 +716,6 @@ weston_surface_draw(struct weston_surface *es, struct weston_output *output)
        GLint filter;
        int n;
 
-       weston_surface_update_transform(es);
-
        pixman_region32_init(&repaint);
        pixman_region32_intersect(&repaint, &es->transform.boundingbox,
                                  &output->region);
@@ -892,8 +890,6 @@ weston_output_set_cursor(struct weston_output *output,
        if (device->sprite == NULL)
                return;
 
-       weston_surface_update_transform(device->sprite);
-
        pixman_region32_init(&cursor_region);
        pixman_region32_intersect(&cursor_region,
                                  &device->sprite->transform.boundingbox,
@@ -951,6 +947,8 @@ weston_output_repaint(struct weston_output *output, int msecs)
        pixman_region32_init(&overlap);
 
        wl_list_for_each(es, &ec->surface_list, link) {
+               /* Update surface transform now to avoid calling it ever
+                * again from the repaint sub-functions. */
                weston_surface_update_transform(es);
 
                pixman_region32_init(&surface_overlap);
index 5632c73..fbb1203 100644 (file)
@@ -1034,6 +1034,11 @@ rotate_grab_motion(struct wl_grab *grab,
                weston_matrix_init(&surface->rotation.rotation);
                weston_matrix_init(&rotate->rotation);
        }
+
+       /* Repaint implies weston_surface_update_transform(), which
+        * lazily applies the damage due to rotation update.
+        */
+       weston_compositor_schedule_repaint(surface->surface->compositor);
 }
 
 static void