[Spice-devel] [PATCH spice-gtk] spice-widget: Fix invalidate region in case of image is scaled
Victor Toso
victortoso at redhat.com
Mon Oct 14 11:47:26 UTC 2019
Hi,
On Mon, Oct 14, 2019 at 11:54:43AM +0100, Frediano Ziglio wrote:
> In case the drawing on the screen is scaled the scaling required to
> invalidate a slightly bigger region.
> This is due to the interpolation done during the resize.
> So if scaling is performed invalidate also the adjacent pixels.
>
> This fixes https://gitlab.freedesktop.org/spice/spice-gtk/issues/19.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> src/spice-widget.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index d73e02f2..9d6899c0 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -2847,6 +2847,14 @@ static void invalidate(SpiceChannel *channel,
> &display_x, &display_y,
> NULL, NULL);
>
> + gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
> + if (s * scale_factor > 1) {
> + rect.x -= 1;
> + rect.y -= 1;
> + rect.width += 2;
> + rect.height += 2;
> + }
> +
Ah, yes. I've tested this ages ago and it was fine. Thanks for
not missing it for any longer.
Acked-by: Victor Toso <victortoso at redhat.com>
> x1 = floor ((rect.x - d->area.x) * s);
> y1 = floor ((rect.y - d->area.y) * s);
> x2 = ceil ((rect.x - d->area.x + rect.width) * s);
> --
> 2.21.0
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20191014/b28705c4/attachment-0001.sig>
More information about the Spice-devel
mailing list