[Spice-devel] [common PATCH 8/8 v3] ppc: Fix alpha state checking and clearing on BE machines

Lukas Venhoda lvenhoda at redhat.com
Wed Nov 4 05:41:55 PST 2015


Self NACK

Wrong order of LE/BE macros
Should be the other way around:

#ifdef WORDS_BIGENDIAN
    #define x8r8g8b8_ALPHA 0x000000ffu
#else
    #define x8r8g8b8_ALPHA 0xff000000u
#endif

Will fix in next version, still some changes left.


On Thu, Oct 22, 2015 at 5:02 PM, Lukas Venhoda <lvenhoda at redhat.com> wrote:

> When checking, whether we use alpha channel, we need to compare color
> format with constant with the same byte order.
>
> When clearing alpha channel, we must clear in proper byte order.
> ---
> Changes since v2:
>  - Added macro for proper alpha clearing
>  - Improved commit msg
>
> Changes since v1:
>  - New commit
> ---
>  common/canvas_base.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/common/canvas_base.c b/common/canvas_base.c
> index 65b1c3f..1e401ed 100644
> --- a/common/canvas_base.c
> +++ b/common/canvas_base.c
> @@ -45,6 +45,12 @@
>  #include "mem.h"
>  #include "macros.h"
>
> +#ifdef WORDS_BIGENDIAN
> +    #define x8r8g8b8_ALPHA 0xff000000u
> +#else
> +    #define x8r8g8b8_ALPHA 0x000000ffu
> +#endif
> +
>  #define ROUND(_x) ((int)floor((_x) + 0.5))
>
>  #define IS_IMAGE_LOSSY(descriptor)                         \
> @@ -1208,12 +1214,12 @@ static pixman_image_t
> *canvas_get_image_internal(CanvasBase *canvas, SpiceImage
>  #ifdef SW_CANVAS_CACHE
>          descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS &&
>  #endif
> -        surface_format == PIXMAN_x8r8g8b8) {
> +        surface_format == PIXMAN_LE_x8r8g8b8) {
>          spice_pixman_fill_rect_rop(surface,
>                                     0, 0,
>                                     pixman_image_get_width(surface),
>                                     pixman_image_get_height(surface),
> -                                   0xff000000U, SPICE_ROP_OR);
> +                                   x8r8g8b8_ALPHA, SPICE_ROP_OR);
>      }
>
>      if (descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME &&
> @@ -1267,7 +1273,7 @@ static pixman_image_t
> *canvas_get_image_internal(CanvasBase *canvas, SpiceImage
>             If so we convert here. */
>
>          wanted_format = canvas_get_target_format(canvas,
> -                                                 surface_format ==
> PIXMAN_a8r8g8b8);
> +                                                 surface_format ==
> PIXMAN_LE_a8r8g8b8);
>
>          if (surface_format != wanted_format) {
>              converted = surface_create(
> --
> 2.4.3
>
>
Lukas Venhoda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151104/6cbbbb86/attachment.html>


More information about the Spice-devel mailing list