<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 10, 2015 at 6:01 AM, Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Pekka Paalanen <<a href="mailto:pekka.paalanen@collabora.co.uk">pekka.paalanen@collabora.co.uk</a>><br>
<br>
Move code into a new helper function. No changes.<br>
<br>
Signed-off-by: Pekka Paalanen <<a href="mailto:pekka.paalanen@collabora.co.uk">pekka.paalanen@collabora.co.uk</a>><br>
Reviewed-By: Derek Foreman <<a href="mailto:derekf@osg.samsung.com">derekf@osg.samsung.com</a>><br>
---<br>
 src/pixman-renderer.c | 31 ++++++++++++++++++-------------<br>
 1 file changed, 18 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c<br>
index 8fd50e3..96123cb 100644<br>
--- a/src/pixman-renderer.c<br>
+++ b/src/pixman-renderer.c<br>
@@ -181,6 +181,22 @@ pixman_renderer_compute_transform(pixman_transform_t *transform_out,<br>
 }<br>
<br>
 static void<br>
+region_intersect_only_translation(pixman_region32_t *result_global,<br>
+                                 pixman_region32_t *global,<br>
+                                 pixman_region32_t *surf,<br>
+                                 struct weston_view *view)<br>
+{<br>
+       float view_x, view_y;<br></blockquote><div><br></div><div>We should have an assert in here that it really is only translation.  Both for documentation and for sanity.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+       /* Convert from surface to global coordinates */<br>
+       pixman_region32_copy(result_global, surf);<br>
+       weston_view_to_global_float(view, 0, 0, &view_x, &view_y);<br>
+       pixman_region32_translate(result_global, (int)view_x, (int)view_y);<br>
+<br>
+       pixman_region32_intersect(result_global, result_global, global);<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>
@@ -191,7 +207,6 @@ repaint_region(struct weston_view *ev, struct weston_output *output,<br>
        struct pixman_output_state *po = get_output_state(output);<br>
        struct weston_buffer_viewport *vp = &ev->surface->buffer_viewport;<br>
        pixman_region32_t final_region;<br>
-       float view_x, view_y;<br>
        pixman_transform_t transform;<br>
        pixman_image_t *mask_image;<br>
        pixman_color_t mask = { 0, };<br>
@@ -203,18 +218,8 @@ repaint_region(struct weston_view *ev, struct weston_output *output,<br>
         */<br>
        pixman_region32_init(&final_region);<br>
        if (surf_region) {<br>
-               pixman_region32_copy(&final_region, surf_region);<br>
-<br>
-               /* Convert from surface to global coordinates */<br>
-               if (!ev->transform.enabled) {<br>
-                       pixman_region32_translate(&final_region, ev->geometry.x, ev->geometry.y);<br>
-               } else {<br>
-                       weston_view_to_global_float(ev, 0, 0, &view_x, &view_y);<br>
-                       pixman_region32_translate(&final_region, (int)view_x, (int)view_y);<br>
-               }<br>
-<br>
-               /* We need to paint the intersection */<br>
-               pixman_region32_intersect(&final_region, &final_region, region);<br>
+               region_intersect_only_translation(&final_region, region,<br>
+                                                 surf_region, ev);<br>
        } else {<br>
                /* If there is no surface region, just use the global region */<br>
                pixman_region32_copy(&final_region, region);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.0.5<br>
<br>
</font></span></blockquote></div><br></div></div>