[Spice-commits] server/red_worker.c

Alexander Larsson alexl at kemper.freedesktop.org
Fri Apr 30 00:54:13 PDT 2010


 server/red_worker.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 295c8ed8bc508d69c88ec83b82afc4573500ff12
Author: Alexander Larsson <alexl at redhat.com>
Date:   Fri Apr 30 09:52:42 2010 +0200

    Don't send alpha bytes for primary surface
    
    The framebuffer is not used as a source for alpha blends, so we never
    need to scan it for alpha bytes.

diff --git a/server/red_worker.c b/server/red_worker.c
index 3cd9374..e9b2ade 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -3653,7 +3653,10 @@ static inline int red_handle_self_bitmap(RedWorker *worker, Drawable *drawable)
     red_get_area(worker, drawable->surface_id,
                  &drawable->qxl_drawable->self_bitmap_area, dest, dest_stride, TRUE);
 
-    if (image->bitmap.format == SPICE_BITMAP_FMT_32BIT &&
+    /* For 32bit non-primary surfaces we need to keep any non-zero
+       high bytes as the surface may be used as source to an alpha_blend */
+    if (!is_primary_surface(worker, drawable->surface_id) &&
+        image->bitmap.format == SPICE_BITMAP_FMT_32BIT &&
         rgb32_data_has_alpha(width, height, dest_stride, dest, &all_set)) {
         if (all_set) {
             image->descriptor.flags |= SPICE_IMAGE_FLAGS_HIGH_BITS_SET;
@@ -4987,7 +4990,10 @@ static void red_add_surface_image(RedWorker *worker, int surface_id)
     area.bottom = surface->context.height;
     canvas->ops->read_bits(canvas, item->data, stride, &area);
 
-    if (item->image_format == SPICE_BITMAP_FMT_32BIT &&
+    /* For 32bit non-primary surfaces we need to keep any non-zero
+       high bytes as the surface may be used as source to an alpha_blend */
+    if (!is_primary_surface(worker, surface_id) &&
+        item->image_format == SPICE_BITMAP_FMT_32BIT &&
         rgb32_data_has_alpha(item->width, item->height, item->stride, item->data, &all_set)) {
         if (all_set) {
             item->image_flags |= SPICE_IMAGE_FLAGS_HIGH_BITS_SET;


More information about the Spice-commits mailing list