[PATCH weston 3/8] pixman-renderer: refactor into region_intersect_only_translation()
Pekka Paalanen
ppaalanen at gmail.com
Fri Mar 6 03:03:58 PST 2015
From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
Move code into a new helper function. No changes.
Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
src/pixman-renderer.c | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c
index 2769168..459b20a 100644
--- a/src/pixman-renderer.c
+++ b/src/pixman-renderer.c
@@ -299,6 +299,22 @@ pixman_renderer_compute_transform(pixman_transform_t *transform_out,
}
static void
+region_intersect_only_translation(pixman_region32_t *result_global,
+ pixman_region32_t *global,
+ pixman_region32_t *surf,
+ struct weston_view *view)
+{
+ float view_x, view_y;
+
+ /* Convert from surface to global coordinates */
+ pixman_region32_copy(result_global, surf);
+ weston_view_to_global_float(view, 0, 0, &view_x, &view_y);
+ pixman_region32_translate(result_global, (int)view_x, (int)view_y);
+
+ pixman_region32_intersect(result_global, result_global, global);
+}
+
+static void
repaint_region(struct weston_view *ev, struct weston_output *output,
pixman_region32_t *region, pixman_region32_t *surf_region,
pixman_op_t pixman_op)
@@ -309,7 +325,6 @@ repaint_region(struct weston_view *ev, struct weston_output *output,
struct pixman_output_state *po = get_output_state(output);
struct weston_buffer_viewport *vp = &ev->surface->buffer_viewport;
pixman_region32_t final_region;
- float view_x, view_y;
pixman_transform_t transform;
pixman_image_t *mask_image;
pixman_color_t mask = { 0, };
@@ -321,18 +336,8 @@ repaint_region(struct weston_view *ev, struct weston_output *output,
*/
pixman_region32_init(&final_region);
if (surf_region) {
- pixman_region32_copy(&final_region, surf_region);
-
- /* Convert from surface to global coordinates */
- if (!ev->transform.enabled) {
- pixman_region32_translate(&final_region, ev->geometry.x, ev->geometry.y);
- } else {
- weston_view_to_global_float(ev, 0, 0, &view_x, &view_y);
- pixman_region32_translate(&final_region, (int)view_x, (int)view_y);
- }
-
- /* We need to paint the intersection */
- pixman_region32_intersect(&final_region, &final_region, region);
+ region_intersect_only_translation(&final_region, region,
+ surf_region, ev);
} else {
/* If there is no surface region, just use the global region */
pixman_region32_copy(&final_region, region);
--
2.0.5
More information about the wayland-devel
mailing list