<p dir="ltr">Derek,<br>
I haven't had a chance to look that hard at or play with this patch yet.  Hopefully I can look at it before too long.  One quick question though:  Have you verified that this works with all of the output transforms?  I'm sorry if this seems premature but a) pixman renderer stuff is hard to get right and b) people are constantly breaking the pixman renderer with respect to output transforms.  So I thought the question was worth asking even if I haven't had time to review yet.</p>

<p dir="ltr">FWIW, I have a series on my github that accomplishes the same thing only with substantially deeper changes to Weston:</p>
<p dir="ltr"><a href="https://github.com/jekstrand/weston/commits/wip/transforms">https://github.com/jekstrand/weston/commits/wip/transforms</a></p>
<p dir="ltr">--Jason Ekstrand</p>
<div class="gmail_quote">On Aug 29, 2014 7:56 AM, "Derek Foreman" <<a href="mailto:derekf@osg.samsung.com">derekf@osg.samsung.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Currently if you try to zoom with mod+scrollwheel the pixman<br>
backend will stop rendering anything at all and will continuously<br>
log "pixman renderer does not support zoom", giving the impression<br>
that the server is hung.<br>
<br>
Instead, this patch adds the missing zoom functionality.<br>
<br>
This should close BUG 80258<br>
---<br>
 src/pixman-renderer.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++-----<br>
 1 file changed, 59 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c<br>
index 4fdcb05..55e8824 100644<br>
--- a/src/pixman-renderer.c<br>
+++ b/src/pixman-renderer.c<br>
@@ -168,6 +168,37 @@ transform_apply_viewport(pixman_transform_t *transform,<br>
 }<br>
<br>
 static void<br>
+region_apply_zoom(struct weston_output *output,<br>
+                 pixman_region32_t *region)<br>
+{<br>
+       pixman_box32_t *rects, *zoomed_rects;<br>
+       int nrects, i;<br>
+       double mag, tx, ty, zoomw, zoomh;<br>
+<br>
+       mag = 1.0 / (1.0 - output->zoom.spring_z.current);<br>
+       zoomw = mag * output->width;<br>
+       zoomh = mag * output->height;<br>
+       tx = output->zoom.trans_x * output->width/2.0;<br>
+       ty = output->zoom.trans_y * output->height/2.0;<br>
+       rects = pixman_region32_rectangles(region, &nrects);<br>
+       zoomed_rects = calloc(nrects, sizeof(pixman_box32_t));<br>
+<br>
+       for (i = 0; i < nrects; i++) {<br>
+               zoomed_rects[i].x1 = (output->width / 2.0)<br>
+                                  + mag * (rects[i].x1 - tx) - zoomw / 2.0;<br>
+               zoomed_rects[i].x2 = (output->width / 2.0)<br>
+                                  + mag * (rects[i].x2 - tx) - zoomw / 2.0;<br>
+               zoomed_rects[i].y1 = (output->height / 2.0)<br>
+                                  + mag * (rects[i].y1 - ty) - zoomh / 2.0;<br>
+               zoomed_rects[i].y2 = (output->height / 2.0)<br>
+                                  + mag * (rects[i].y2 - ty) - zoomh / 2.0;<br>
+       }<br>
+       pixman_region32_clear(region);<br>
+       pixman_region32_init_rects(region, zoomed_rects, nrects);<br>
+       free(zoomed_rects);<br>
+}<br>
+<br>
+static void<br>
 repaint_region(struct weston_view *ev, struct weston_output *output,<br>
               pixman_region32_t *region, pixman_region32_t *surf_region,<br>
               pixman_op_t pixman_op)<br>
@@ -211,6 +242,10 @@ repaint_region(struct weston_view *ev, struct weston_output *output,<br>
        /* Convert from global to output coord */<br>
        region_global_to_output(output, &final_region);<br>
<br>
+       /* Apply zoom if applicable */<br>
+       if (output->zoom.active)<br>
+               region_apply_zoom(output, &final_region);<br>
+<br>
        /* And clip to it */<br>
        pixman_image_set_clip_region32 (po->shadow_image, &final_region);<br>
<br>
@@ -218,6 +253,25 @@ repaint_region(struct weston_view *ev, struct weston_output *output,<br>
           position, the output position/transform/scale and the client<br>
           specified buffer transform/scale */<br>
        pixman_transform_init_identity(&transform);<br>
+<br>
+       if (output->zoom.active) {<br>
+               double mag, zoomw, zoomh, tx, ty;<br>
+<br>
+               mag = 1.0f - output->zoom.spring_z.current;<br>
+               zoomw = mag * output->width;<br>
+               zoomh = mag * output->height;<br>
+               tx = output->zoom.trans_x * output->width/2.0 - (zoomw - output->width) / 2.0;<br>
+               ty = output->zoom.trans_y * output->height/2.0 - (zoomh - output->height) / 2.0;<br>
+<br>
+               pixman_transform_scale(&transform, NULL,<br>
+                                      pixman_double_to_fixed (mag),<br>
+                                      pixman_double_to_fixed (mag));<br>
+<br>
+               pixman_transform_translate(&transform, NULL,<br>
+                                          pixman_double_to_fixed(tx),<br>
+                                          pixman_double_to_fixed(ty));<br>
+       }<br>
+<br>
        pixman_transform_scale(&transform, NULL,<br>
                               pixman_double_to_fixed ((double)1.0/output->current_scale),<br>
                               pixman_double_to_fixed ((double)1.0/output->current_scale));<br>
@@ -334,7 +388,8 @@ repaint_region(struct weston_view *ev, struct weston_output *output,<br>
<br>
        pixman_image_set_transform(ps->image, &transform);<br>
<br>
-       if (ev->transform.enabled || output->current_scale != vp->buffer.scale)<br>
+       if (ev->transform.enabled || output->current_scale != vp->buffer.scale<br>
+           || output->zoom.active)<br>
                pixman_image_set_filter(ps->image, PIXMAN_FILTER_BILINEAR, NULL, 0);<br>
        else<br>
                pixman_image_set_filter(ps->image, PIXMAN_FILTER_NEAREST, NULL, 0);<br>
@@ -403,11 +458,6 @@ draw_view(struct weston_view *ev, struct weston_output *output,<br>
        if (!pixman_region32_not_empty(&repaint))<br>
                goto out;<br>
<br>
-       if (output->zoom.active) {<br>
-               weston_log("pixman renderer does not support zoom\n");<br>
-               goto out;<br>
-       }<br>
-<br>
        /* TODO: Implement repaint_region_complex() using pixman_composite_trapezoids() */<br>
        if (ev->alpha != 1.0 ||<br>
            (ev->transform.enabled &&<br>
@@ -455,6 +505,9 @@ copy_to_hw_buffer(struct weston_output *output, pixman_region32_t *region)<br>
<br>
        region_global_to_output(output, &output_region);<br>
<br>
+       if (output->zoom.active)<br>
+               region_apply_zoom(output, &output_region);<br>
+<br>
        pixman_image_set_clip_region32 (po->hw_buffer, &output_region);<br>
<br>
        pixman_image_composite32(PIXMAN_OP_SRC,<br>
--<br>
2.1.0.rc1<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</blockquote></div>