libweston: rename weston_output_region_from_global

Rename weston_output_region_from_global to weston_region_global_to_output,
and also no longer modify in place.

Trying to make it look a little nicer, as well as making it easier to use
from other places that don't want modify in place semantics.

This becomes a very thin wrapper around weston_matrix_transform_region.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2022-09-20 14:53:27 -05:00 committed by Pekka Paalanen
parent 2e5b62079b
commit 342afb390b
4 changed files with 21 additions and 13 deletions

View file

@ -172,8 +172,9 @@ weston_output_transform_coordinate(struct weston_output *output,
double *x, double *y);
void
weston_output_region_from_global(struct weston_output *output,
pixman_region32_t *region);
weston_region_global_to_output(pixman_region32_t *dst,
struct weston_output *output,
pixman_region32_t *src);
const struct weston_hdr_metadata_type1 *
weston_output_get_hdr_metadata_type1(const struct weston_output *output);

View file

@ -6202,10 +6202,11 @@ weston_compositor_reflow_outputs(struct weston_compositor *compositor,
}
}
/** Transform a region in-place from global to output coordinates
/** Transform a region from global to output coordinates
*
* \param dst The region transformed into output coordinates
* \param output The output that defines the transformation.
* \param region The region to be transformed in-place.
* \param src The region to be transformed, in global coordinates.
*
* This takes a region in the global coordinate system, and takes into account
* output position, transform and scale, and converts the region into output
@ -6215,10 +6216,11 @@ weston_compositor_reflow_outputs(struct weston_compositor *compositor,
* \ingroup output
*/
WL_EXPORT void
weston_output_region_from_global(struct weston_output *output,
pixman_region32_t *region)
weston_region_global_to_output(pixman_region32_t *dst,
struct weston_output *output,
pixman_region32_t *src)
{
weston_matrix_transform_region(region, &output->matrix, region);
weston_matrix_transform_region(dst, &output->matrix, src);
}
static void

View file

@ -414,8 +414,9 @@ draw_view_translated(struct weston_view *view, struct weston_output *output,
repaint_global,
&surface->opaque,
view);
weston_output_region_from_global(output,
&repaint_output);
weston_region_global_to_output(&repaint_output,
output,
&repaint_output);
repaint_region(view, output, &repaint_output, NULL,
PIXMAN_OP_SRC);
@ -426,7 +427,9 @@ draw_view_translated(struct weston_view *view, struct weston_output *output,
region_intersect_only_translation(&repaint_output,
repaint_global,
&surface_blend, view);
weston_output_region_from_global(output, &repaint_output);
weston_region_global_to_output(&repaint_output,
output,
&repaint_output);
repaint_region(view, output, &repaint_output, NULL,
PIXMAN_OP_OVER);
@ -462,7 +465,8 @@ draw_view_source_clipped(struct weston_view *view,
pixman_region32_init(&repaint_output);
pixman_region32_copy(&repaint_output, repaint_global);
weston_output_region_from_global(output, &repaint_output);
weston_region_global_to_output(&repaint_output, output,
&repaint_output);
repaint_region(view, output, &repaint_output, &buffer_region,
PIXMAN_OP_OVER);
@ -555,7 +559,7 @@ copy_to_hw_buffer(struct weston_output *output, pixman_region32_t *region)
pixman_region32_init(&output_region);
pixman_region32_copy(&output_region, region);
weston_output_region_from_global(output, &output_region);
weston_region_global_to_output(&output_region, output, &output_region);
pixman_image_set_clip_region32 (po->hw_buffer, &output_region);
pixman_region32_fini(&output_region);

View file

@ -1531,7 +1531,8 @@ blit_shadow_to_output(struct weston_output *output,
pixman_region32_intersect(&translated_damage, output_damage,
&output->region);
/* Convert to output pixel coordinates in-place */
weston_output_region_from_global(output, &translated_damage);
weston_region_global_to_output(&translated_damage, output,
&translated_damage);
rects = pixman_region32_rectangles(&translated_damage, &n_rects);
for (i = 0; i < n_rects; i++) {