[PATCH weston 1/4] libweston: Export weston_output_transform_scale_init
Pekka Paalanen
ppaalanen at gmail.com
Fri Oct 7 09:52:29 UTC 2016
On Fri, 30 Sep 2016 23:25:27 +0200
Armin Krezović <krezovic.armin at gmail.com> wrote:
> This is required for implementing output layout setting
> which relies on current output width and height, and
> those are calculated in this function.
>
> It also changes the function signature to make use
> of already stored scale and transform values in the
> weston_output object.
>
> Signed-off-by: Armin Krezović <krezovic.armin at gmail.com>
> ---
> libweston/compositor.c | 31 ++++++++++++++++++-------------
> libweston/compositor.h | 2 ++
> 2 files changed, 20 insertions(+), 13 deletions(-)
Hi,
I think this would need a bit more thought on the API.
The requirement is that one has to set some output parameters (video
mode, transform, scale) before the output size is available. Output
size then is needed for doing the layout.
IMO it would make more sense to add a new function
weston_output_get_size(), which would take into account the currently
set (pending) parameters and compute the resulting size.
This is also good in the long term since we would like to make struct
weston_output opaque to the libweston user. We are going to need a
getter for the size anyway.
Thanks,
pq
>
> diff --git a/libweston/compositor.c b/libweston/compositor.c
> index d552e18..7ebc08c 100644
> --- a/libweston/compositor.c
> +++ b/libweston/compositor.c
> @@ -67,10 +67,6 @@
> #define DEFAULT_REPAINT_WINDOW 7 /* milliseconds */
>
> static void
> -weston_output_transform_scale_init(struct weston_output *output,
> - uint32_t transform, uint32_t scale);
> -
> -static void
> weston_compositor_build_view_list(struct weston_compositor *compositor);
>
> static void weston_mode_switch_finish(struct weston_output *output,
> @@ -86,7 +82,7 @@ static void weston_mode_switch_finish(struct weston_output *output,
> pixman_region32_copy(&old_output_region, &output->region);
>
> /* Update output region and transformation matrix */
> - weston_output_transform_scale_init(output, output->transform, output->current_scale);
> + weston_output_transform_scale_init(output);
>
> pixman_region32_init(&output->previous_damage);
> pixman_region32_init_rect(&output->region, output->x, output->y,
> @@ -4212,17 +4208,25 @@ weston_output_update_matrix(struct weston_output *output)
> weston_matrix_invert(&output->inverse_matrix, &output->matrix);
> }
>
> -static void
> -weston_output_transform_scale_init(struct weston_output *output, uint32_t transform, uint32_t scale)
> +WL_EXPORT void
> +weston_output_transform_scale_init(struct weston_output *output)
> {
> - output->transform = transform;
> - output->native_scale = scale;
> - output->current_scale = scale;
> + /* Make sure transform and scale are set */
> + assert(output->scale);
> + assert(output->transform != UINT32_MAX);
> +
> + /* Make sure output->current_mode has been constructed. */
> + assert(output->current_mode);
> +
> + /* TODO: Use output->original_scale in weston_output_set_scale() */
> + output->original_scale = output->scale;
> + output->native_scale = output->scale;
> + output->current_scale = output->scale;
>
> convert_size_by_transform_scale(&output->width, &output->height,
> output->current_mode->width,
> output->current_mode->height,
> - transform, scale);
> + output->transform, output->scale);
> }
>
> static void
> @@ -4448,6 +4452,8 @@ weston_output_init(struct weston_output *output,
> output->scale = 0;
> /* Can't use -1 on uint32_t and 0 is valid enum value */
> output->transform = UINT32_MAX;
> +
> + output->current_mode = NULL;
> }
>
> /** Adds weston_output object to pending output list.
> @@ -4529,9 +4535,8 @@ weston_output_enable(struct weston_output *output)
> output->x = x;
> output->y = y;
> output->dirty = 1;
> - output->original_scale = output->scale;
>
> - weston_output_transform_scale_init(output, output->transform, output->scale);
> + weston_output_transform_scale_init(output);
> weston_output_init_zoom(output);
>
> weston_output_init_geometry(output, x, y);
> diff --git a/libweston/compositor.h b/libweston/compositor.h
> index 3e486d5..a39b327 100644
> --- a/libweston/compositor.h
> +++ b/libweston/compositor.h
> @@ -1596,6 +1596,8 @@ weston_output_activate_zoom(struct weston_output *output,
> void
> weston_output_update_matrix(struct weston_output *output);
> void
> +weston_output_transform_scale_init(struct weston_output *output);
> +void
> weston_output_move(struct weston_output *output, int x, int y);
>
> void
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20161007/c48f2cb8/attachment.sig>
More information about the wayland-devel
mailing list