[Spice-devel] [PATCH spice-common v2] canvas-base: Do not attempt useless cast on stride adjustment

Christophe Fergeau cfergeau at redhat.com
Wed Jun 21 10:17:27 UTC 2017


Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Wed, Jun 21, 2017 at 10:40:23AM +0100, Frediano Ziglio wrote:
> memmove already deal with any alignment so there's no
> reason to have row byte pointer cast to uint32_t.
> This also remove the confusing "dest" terminology used. The image
> is aligned in place so the image bits are used for both destination
> and source.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  common/canvas_base.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> Changes since v1:
> - remove confusing "dest" terminology.
> 
> diff --git a/common/canvas_base.c b/common/canvas_base.c
> index 5815e9c..ed0de73 100644
> --- a/common/canvas_base.c
> +++ b/common/canvas_base.c
> @@ -520,12 +520,11 @@ static void canvas_fix_alignment(uint8_t *bits,
>      if (stride_pixman > stride_encoded) {
>          // Fix the row alignment
>          int row;
> -        uint8_t *dest = bits;
>          for (row = height - 1; row > 0; --row) {
> -            uint32_t *dest_aligned, *dest_misaligned;
> -            dest_aligned = SPICE_ALIGNED_CAST(uint32_t *,dest + stride_pixman*row);
> -            dest_misaligned = SPICE_UNALIGNED_CAST(uint32_t*,dest + stride_encoded*row);
> -            memmove(dest_aligned, dest_misaligned, stride_encoded);
> +            uint8_t *aligned, *misaligned;
> +            aligned = bits + stride_pixman*row;
> +            misaligned = bits + stride_encoded*row;
> +            memmove(aligned, misaligned, stride_encoded);
>          }
>      }
>  }
> -- 
> 2.9.4
> 
> _______________________________________________
> 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: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170621/55c3f454/attachment.sig>


More information about the Spice-devel mailing list