[gtk-vnc] src: fix remote pixel format when reading alpha cursor



commit d3ac85e64fcad22d1a165ecb67c5909a566d40fb
Author: Daniel P. Berrangé <dan berrange com>
Date:   Wed Mar 31 22:06:50 2021 +0100

    src: fix remote pixel format when reading alpha cursor
    
    The remote pixel format for alpha cursor is always RGB888
    true colour, regardless of the framebuffer pixel format.
    
    Signed-off-by: Daniel P. Berrangé <berrange redhat com>

 src/vncconnection.c | 171 ++++++++++++++++++++++++++++------------------------
 1 file changed, 91 insertions(+), 80 deletions(-)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index d771f8c..ff26162 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -1156,19 +1156,19 @@ static ssize_t vnc_connection_tls_pull(gnutls_transport_ptr_t transport,
     return ret;
 }
 
-static size_t vnc_connection_pixel_size(VncConnection *conn)
+static size_t vnc_connection_pixel_size(VncPixelFormat *fmt)
 {
-    VncConnectionPrivate *priv = conn->priv;
-
-    return priv->fmt.bits_per_pixel / 8;
+    return fmt->bits_per_pixel / 8;
 }
 
 /*
  * Must only be called from the VNC coroutine
  */
-static void vnc_connection_read_pixel(VncConnection *conn, guint8 *pixel)
+static void vnc_connection_read_pixel(VncConnection *conn,
+                                      VncPixelFormat *fmt,
+                                      guint8 *pixel)
 {
-    vnc_connection_read(conn, pixel, vnc_connection_pixel_size(conn));
+    vnc_connection_read(conn, pixel, vnc_connection_pixel_size(fmt));
 }
 
 /*
@@ -2162,11 +2162,10 @@ static gboolean vnc_connection_validate_boundary(VncConnection *conn,
 
 static void vnc_connection_raw_update(VncConnection *conn,
                                       VncFramebuffer *fb,
+                                      VncPixelFormat *fmt,
                                       guint16 x, guint16 y,
                                       guint16 width, guint16 height)
 {
-    VncConnectionPrivate *priv = conn->priv;
-
     /* optimize for perfect match between server/client
        FWIW, in the local case, we ought to be doing a write
        directly from the source framebuffer and a read directly
@@ -2177,20 +2176,20 @@ static void vnc_connection_raw_update(VncConnection *conn,
         int rowstride = vnc_framebuffer_get_rowstride(fb);
         guint8 *dst = vnc_framebuffer_get_buffer(fb);
 
-        dst += (y * rowstride) + (x * (priv->fmt.bits_per_pixel/8));
+        dst += (y * rowstride) + (x * (fmt->bits_per_pixel/8));
 
         for (i = 0; i < height; i++) {
             vnc_connection_read(conn, dst,
-                                width * (priv->fmt.bits_per_pixel/8));
+                                width * (fmt->bits_per_pixel/8));
             dst += rowstride;
         }
     } else {
         guint8 *dst;
         int i;
 
-        dst = g_malloc(width * (priv->fmt.bits_per_pixel / 8));
+        dst = g_malloc(width * (fmt->bits_per_pixel / 8));
         for (i = 0; i < height; i++) {
-            vnc_connection_read(conn, dst, width * (priv->fmt.bits_per_pixel / 8));
+            vnc_connection_read(conn, dst, width * (fmt->bits_per_pixel / 8));
             vnc_framebuffer_blt(fb, dst, 0, x, y + i, width, 1);
         }
         g_free(dst);
@@ -2219,6 +2218,7 @@ static void vnc_connection_copyrect_update(VncConnection *conn,
 
 static void vnc_connection_hextile_rect(VncConnection *conn,
                                         VncFramebuffer *fb,
+                                        VncPixelFormat *fmt,
                                         guint8 flags,
                                         guint16 x, guint16 y,
                                         guint16 width, guint16 height,
@@ -2227,15 +2227,15 @@ static void vnc_connection_hextile_rect(VncConnection *conn,
     int i;
 
     if (flags & 0x01) {
-        vnc_connection_raw_update(conn, fb, x, y, width, height);
+        vnc_connection_raw_update(conn, fb, fmt, x, y, width, height);
     } else {
         /* Background Specified */
         if (flags & 0x02)
-            vnc_connection_read_pixel(conn, bg);
+            vnc_connection_read_pixel(conn, fmt, bg);
 
         /* Foreground Specified */
         if (flags & 0x04)
-            vnc_connection_read_pixel(conn, fg);
+            vnc_connection_read_pixel(conn, fmt, fg);
 
         vnc_framebuffer_fill(fb, bg, x, y, width, height);
 
@@ -2248,7 +2248,7 @@ static void vnc_connection_hextile_rect(VncConnection *conn,
 
                 /* SubrectsColored */
                 if (flags & 0x10)
-                    vnc_connection_read_pixel(conn, fg);
+                    vnc_connection_read_pixel(conn, fmt, fg);
 
                 xy = vnc_connection_read_u8(conn);
                 wh = vnc_connection_read_u8(conn);
@@ -2269,6 +2269,7 @@ static void vnc_connection_hextile_rect(VncConnection *conn,
 
 static void vnc_connection_hextile_update(VncConnection *conn,
                                           VncFramebuffer *fb,
+                                          VncPixelFormat *fmt,
                                           guint16 x, guint16 y,
                                           guint16 width, guint16 height)
 {
@@ -2284,7 +2285,7 @@ static void vnc_connection_hextile_update(VncConnection *conn,
             int h = MIN(16, height - j);
 
             flags = vnc_connection_read_u8(conn);
-            vnc_connection_hextile_rect(conn, fb, flags,
+            vnc_connection_hextile_rect(conn, fb, fmt, flags,
                                         x + i, y + j,
                                         w, h,
                                         fg, bg);
@@ -2294,6 +2295,7 @@ static void vnc_connection_hextile_update(VncConnection *conn,
 
 static void vnc_connection_rre_update(VncConnection *conn,
                                       VncFramebuffer *fb,
+                                      VncPixelFormat *fmt,
                                       guint16 x, guint16 y,
                                       guint16 width, guint16 height)
 {
@@ -2302,14 +2304,14 @@ static void vnc_connection_rre_update(VncConnection *conn,
     guint32 i;
 
     num = vnc_connection_read_u32(conn);
-    vnc_connection_read_pixel(conn, bg);
+    vnc_connection_read_pixel(conn, fmt, bg);
     vnc_framebuffer_fill(fb, bg, x, y, width, height);
 
     for (i = 0; i < num; i++) {
         guint8 fg[4];
         guint16 sub_x, sub_y, sub_w, sub_h;
 
-        vnc_connection_read_pixel(conn, fg);
+        vnc_connection_read_pixel(conn, fmt, fg);
         sub_x = vnc_connection_read_u16(conn);
         sub_y = vnc_connection_read_u16(conn);
         sub_w = vnc_connection_read_u16(conn);
@@ -2326,20 +2328,21 @@ static void vnc_connection_rre_update(VncConnection *conn,
 
 /* CPIXELs are optimized slightly.  32-bit pixel values are packed into 24-bit
  * values. */
-static void vnc_connection_read_cpixel(VncConnection *conn, guint8 *pixel)
+static void vnc_connection_read_cpixel(VncConnection *conn,
+                                       VncPixelFormat *fmt,
+                                       guint8 *pixel)
 {
-    VncConnectionPrivate *priv = conn->priv;
-    int bpp = vnc_connection_pixel_size(conn);
+    int bpp = vnc_connection_pixel_size(fmt);
 
     memset(pixel, 0, bpp);
 
-    if (bpp == 4 && priv->fmt.true_color_flag) {
-        int fitsInMSB = ((priv->fmt.red_shift > 7) &&
-                         (priv->fmt.green_shift > 7) &&
-                         (priv->fmt.blue_shift > 7));
-        int fitsInLSB = (((priv->fmt.red_max << priv->fmt.red_shift) < (1 << 24)) &&
-                         ((priv->fmt.green_max << priv->fmt.green_shift) < (1 << 24)) &&
-                         ((priv->fmt.blue_max << priv->fmt.blue_shift) < (1 << 24)));
+    if (bpp == 4 && fmt->true_color_flag) {
+        int fitsInMSB = ((fmt->red_shift > 7) &&
+                         (fmt->green_shift > 7) &&
+                         (fmt->blue_shift > 7));
+        int fitsInLSB = (((fmt->red_max << fmt->red_shift) < (1 << 24)) &&
+                         ((fmt->green_max << fmt->green_shift) < (1 << 24)) &&
+                         ((fmt->blue_max << fmt->blue_shift) < (1 << 24)));
 
         /*
          * We need to analyse the shifts to see if they fit in 3 bytes,
@@ -2349,8 +2352,8 @@ static void vnc_connection_read_cpixel(VncConnection *conn, guint8 *pixel)
          */
         if (fitsInMSB || fitsInLSB) {
             bpp = 3;
-            if (priv->fmt.depth == 24 &&
-                priv->fmt.byte_order == G_BIG_ENDIAN)
+            if (fmt->depth == 24 &&
+                fmt->byte_order == G_BIG_ENDIAN)
                 pixel++;
         }
     }
@@ -2360,6 +2363,7 @@ static void vnc_connection_read_cpixel(VncConnection *conn, guint8 *pixel)
 
 static void vnc_connection_zrle_update_tile_blit(VncConnection *conn,
                                                  VncFramebuffer *fb,
+                                                 VncPixelFormat *fmt,
                                                  guint16 x, guint16 y,
                                                  guint16 width, guint16 height)
 {
@@ -2368,10 +2372,10 @@ static void vnc_connection_zrle_update_tile_blit(VncConnection *conn,
 
     blit_data = g_new0(guint8, 4*64*64);
 
-    bpp = vnc_connection_pixel_size(conn);
+    bpp = vnc_connection_pixel_size(fmt);
 
     for (i = 0; i < width * height; i++)
-        vnc_connection_read_cpixel(conn, blit_data + (i * bpp));
+        vnc_connection_read_cpixel(conn, fmt, blit_data + (i * bpp));
 
     vnc_framebuffer_blt(fb, blit_data, width * bpp, x, y, width, height);
 
@@ -2403,6 +2407,7 @@ static guint8 vnc_connection_read_zrle_pi(VncConnection *conn, int palette_size)
 
 static void vnc_connection_zrle_update_tile_palette(VncConnection *conn,
                                                     VncFramebuffer *fb,
+                                                    VncPixelFormat *fmt,
                                                     guint8 palette_size,
                                                     guint16 x, guint16 y,
                                                     guint16 width, guint16 height)
@@ -2412,7 +2417,7 @@ static void vnc_connection_zrle_update_tile_palette(VncConnection *conn,
     int i, j;
 
     for (i = 0; i < palette_size; i++)
-        vnc_connection_read_cpixel(conn, palette[i]);
+        vnc_connection_read_cpixel(conn, fmt, palette[i]);
 
     for (j = 0; j < height; j++) {
         /* discard any padding bits */
@@ -2442,6 +2447,7 @@ static int vnc_connection_read_zrle_rl(VncConnection *conn)
 
 static void vnc_connection_zrle_update_tile_rle(VncConnection *conn,
                                                 VncFramebuffer *fb,
+                                                VncPixelFormat *fmt,
                                                 guint16 x, guint16 y,
                                                 guint16 width, guint16 height)
 {
@@ -2451,7 +2457,7 @@ static void vnc_connection_zrle_update_tile_rle(VncConnection *conn,
     for (j = 0; j < height; j++) {
         for (i = 0; i < width; i++) {
             if (rl == 0) {
-                vnc_connection_read_cpixel(conn, pixel);
+                vnc_connection_read_cpixel(conn, fmt, pixel);
                 rl = vnc_connection_read_zrle_rl(conn);
             }
             vnc_framebuffer_set_pixel_at(fb, pixel, x + i, y + j);
@@ -2462,6 +2468,7 @@ static void vnc_connection_zrle_update_tile_rle(VncConnection *conn,
 
 static void vnc_connection_zrle_update_tile_prle(VncConnection *conn,
                                                  VncFramebuffer *fb,
+                                                 VncPixelFormat *fmt,
                                                  guint8 palette_size,
                                                  guint16 x, guint16 y,
                                                  guint16 width, guint16 height)
@@ -2471,7 +2478,7 @@ static void vnc_connection_zrle_update_tile_prle(VncConnection *conn,
     guint8 pi = 0;
 
     for (i = 0; i < palette_size; i++)
-        vnc_connection_read_cpixel(conn, palette[i]);
+        vnc_connection_read_cpixel(conn, fmt, palette[i]);
 
     for (j = 0; j < height; j++) {
         for (i = 0; i < width; i++) {
@@ -2492,6 +2499,7 @@ static void vnc_connection_zrle_update_tile_prle(VncConnection *conn,
 
 static void vnc_connection_zrle_update_tile(VncConnection *conn,
                                             VncFramebuffer *fb,
+                                            VncPixelFormat *fmt,
                                             guint16 x, guint16 y,
                                             guint16 width, guint16 height)
 {
@@ -2500,31 +2508,32 @@ static void vnc_connection_zrle_update_tile(VncConnection *conn,
 
     if (subencoding == 0 ) {
         /* Raw pixel data */
-        vnc_connection_zrle_update_tile_blit(conn, fb, x, y, width, height);
+        vnc_connection_zrle_update_tile_blit(conn, fb, fmt, x, y, width, height);
     } else if (subencoding == 1) {
         /* Solid tile of a single color */
-        vnc_connection_read_cpixel(conn, pixel);
+        vnc_connection_read_cpixel(conn, fmt, pixel);
         vnc_framebuffer_fill(fb, pixel, x, y, width, height);
     } else if ((subencoding >= 2) && (subencoding <= 16)) {
         /* Packed palette types */
-        vnc_connection_zrle_update_tile_palette(conn, fb, subencoding,
+        vnc_connection_zrle_update_tile_palette(conn, fb, fmt, subencoding,
                                                 x, y, width, height);
     } else if ((subencoding >= 17) && (subencoding <= 127)) {
         /* FIXME raise error? */
     } else if (subencoding == 128) {
         /* Plain RLE */
-        vnc_connection_zrle_update_tile_rle(conn, fb, x, y, width, height);
+        vnc_connection_zrle_update_tile_rle(conn, fb, fmt, x, y, width, height);
     } else if (subencoding == 129) {
 
     } else if (subencoding >= 130) {
         /* Palette RLE */
-        vnc_connection_zrle_update_tile_prle(conn, fb, subencoding - 128,
+        vnc_connection_zrle_update_tile_prle(conn, fb, fmt, subencoding - 128,
                                              x, y, width, height);
     }
 }
 
 static void vnc_connection_zrle_update(VncConnection *conn,
                                        VncFramebuffer *fb,
+                                       VncPixelFormat *fmt,
                                        guint16 x, guint16 y,
                                        guint16 width, guint16 height)
 {
@@ -2550,7 +2559,7 @@ static void vnc_connection_zrle_update(VncConnection *conn,
 
             w = MIN(width - i, 64);
             h = MIN(height - j, 64);
-            vnc_connection_zrle_update_tile(conn, fb, x + i, y + j, w, h);
+            vnc_connection_zrle_update_tile(conn, fb, fmt, x + i, y + j, w, h);
         }
     }
 
@@ -2584,27 +2593,25 @@ static guint32 vnc_connection_read_cint(VncConnection *conn)
     return value;
 }
 
-static int vnc_connection_tpixel_size(VncConnection *conn)
+static int vnc_connection_tpixel_size(VncPixelFormat *fmt)
 {
-    VncConnectionPrivate *priv = conn->priv;
-
-    if (priv->fmt.depth == 24)
+    if (fmt->depth == 24)
         return 3;
-    return priv->fmt.bits_per_pixel / 8;
+    return fmt->bits_per_pixel / 8;
 }
 
-static void vnc_connection_read_tpixel(VncConnection *conn, guint8 *pixel)
+static void vnc_connection_read_tpixel(VncConnection *conn,
+                                       VncPixelFormat *fmt,
+                                       guint8 *pixel)
 {
-    VncConnectionPrivate *priv = conn->priv;
-
-    if (priv->fmt.depth == 24) {
+    if (fmt->depth == 24) {
         guint32 val;
         vnc_connection_read(conn, pixel, 3);
-        val = (pixel[0] << priv->fmt.red_shift)
-            | (pixel[1] << priv->fmt.green_shift)
-            | (pixel[2] << priv->fmt.blue_shift);
+        val = (pixel[0] << fmt->red_shift)
+            | (pixel[1] << fmt->green_shift)
+            | (pixel[2] << fmt->blue_shift);
 
-        if (priv->fmt.byte_order != G_BYTE_ORDER)
+        if (fmt->byte_order != G_BYTE_ORDER)
             val =   (((val >>  0) & 0xFF) << 24) |
                 (((val >>  8) & 0xFF) << 16) |
                 (((val >> 16) & 0xFF) << 8) |
@@ -2612,11 +2619,12 @@ static void vnc_connection_read_tpixel(VncConnection *conn, guint8 *pixel)
 
         memcpy(pixel, &val, 4);
     } else
-        vnc_connection_read_pixel(conn, pixel);
+        vnc_connection_read_pixel(conn, fmt, pixel);
 }
 
 static void vnc_connection_tight_update_copy(VncConnection *conn,
                                              VncFramebuffer *fb,
+                                             VncPixelFormat *fmt,
                                              guint16 x, guint16 y,
                                              guint16 width, guint16 height)
 {
@@ -2625,7 +2633,7 @@ static void vnc_connection_tight_update_copy(VncConnection *conn,
 
     for (j = 0; j < height; j++) {
         for (i = 0; i < width; i++) {
-            vnc_connection_read_tpixel(conn, pixel);
+            vnc_connection_read_tpixel(conn, fmt, pixel);
             vnc_framebuffer_set_pixel_at(fb, pixel, x + i, y + j);
         }
     }
@@ -2682,6 +2690,7 @@ static void vnc_connection_tight_sum_pixel(VncConnection *conn,
 
 static void vnc_connection_tight_update_gradient(VncConnection *conn,
                                                  VncFramebuffer *fb,
+                                                 VncPixelFormat *fmt,
                                                  guint16 x, guint16 y,
                                                  guint16 width, guint16 height)
 {
@@ -2690,7 +2699,7 @@ static void vnc_connection_tight_update_gradient(VncConnection *conn,
     guint8 *last_row, *row;
     int bpp;
 
-    bpp = vnc_connection_pixel_size(conn);
+    bpp = vnc_connection_pixel_size(fmt);
     last_row = g_malloc(width * bpp);
     row = g_malloc(width * bpp);
 
@@ -2714,7 +2723,7 @@ static void vnc_connection_tight_update_gradient(VncConnection *conn,
                                                    llp);
 
             /* read the difference pixel from the wire */
-            vnc_connection_read_tpixel(conn, row + i * bpp);
+            vnc_connection_read_tpixel(conn, fmt, row + i * bpp);
 
             /* sum the predicted pixel and the difference to get
              * the original pixel value */
@@ -2768,6 +2777,7 @@ static void vnc_connection_tight_update_jpeg(VncConnection *conn,
 
 static void vnc_connection_tight_update(VncConnection *conn,
                                         VncFramebuffer *fb,
+                                        VncPixelFormat *fmt,
                                         guint16 x, guint16 y,
                                         guint16 width, guint16 height)
 {
@@ -2805,7 +2815,7 @@ static void vnc_connection_tight_update(VncConnection *conn,
             palette_size = vnc_connection_read_u8(conn);
             palette_size += 1;
             for (i = 0; i < palette_size; i++)
-                vnc_connection_read_tpixel(conn, palette[i]);
+                vnc_connection_read_tpixel(conn, fmt, palette[i]);
         }
 
         if (filter_id == 1) {
@@ -2814,7 +2824,7 @@ static void vnc_connection_tight_update(VncConnection *conn,
             else
                 data_size = width * height;
         } else
-            data_size = width * height * vnc_connection_tpixel_size(conn);
+            data_size = width * height * vnc_connection_tpixel_size(fmt);
 
         if (data_size >= 12) {
             zlib_length = vnc_connection_read_cint(conn);
@@ -2830,7 +2840,7 @@ static void vnc_connection_tight_update(VncConnection *conn,
 
         switch (filter_id) {
         case 0: /* copy */
-            vnc_connection_tight_update_copy(conn, fb, x, y, width, height);
+            vnc_connection_tight_update_copy(conn, fb, fmt, x, y, width, height);
             break;
         case 1: /* palette */
             vnc_connection_tight_update_palette(conn, fb, palette_size,
@@ -2838,7 +2848,7 @@ static void vnc_connection_tight_update(VncConnection *conn,
                                                 x, y, width, height);
             break;
         case 2: /* gradient */
-            vnc_connection_tight_update_gradient(conn, fb, x, y, width, height);
+            vnc_connection_tight_update_gradient(conn, fb, fmt, x, y, width, height);
             break;
         default: /* error */
             vnc_connection_set_error(conn, "Unexpected tight filter id %d",
@@ -2859,7 +2869,7 @@ static void vnc_connection_tight_update(VncConnection *conn,
     } else if (ccontrol == 8) {
         /* fill */
         /* FIXME check each width; endianness */
-        vnc_connection_read_tpixel(conn, pixel);
+        vnc_connection_read_tpixel(conn, fmt, pixel);
         vnc_framebuffer_fill(fb, pixel, x, y, width, height);
     } else if (ccontrol == 9) {
         /* jpeg */
@@ -3177,16 +3187,17 @@ static void vnc_connection_alpha_cursor(VncConnection *conn, guint16 x, guint16
         guint32 encoding;
         VncFramebuffer *fb;
         guint8 *pixels;
-        VncPixelFormat localFmt = {
+        VncPixelFormat fmt = {
+            .bits_per_pixel = 32,
+            .depth = 32,
+            .byte_order = G_BYTE_ORDER,
+            .true_color_flag = TRUE,
             .red_max = 255,
             .green_max = 255,
             .blue_max = 255,
             .red_shift = 16,
             .green_shift = 8,
             .blue_shift = 0,
-            .depth = 32,
-            .bits_per_pixel = 32,
-            .byte_order = G_BYTE_ORDER,
         };
 
         pixels = g_new0(guint8, width * height * 4);
@@ -3194,8 +3205,8 @@ static void vnc_connection_alpha_cursor(VncConnection *conn, guint16 x, guint16
                                                       width,
                                                       height,
                                                       width * 4,
-                                                      &localFmt,
-                                                      &priv->fmt));
+                                                      &fmt,
+                                                      &fmt));
 
         encoding = vnc_connection_read_u32(conn);
         if (vnc_connection_has_error(conn)) {
@@ -3209,7 +3220,7 @@ static void vnc_connection_alpha_cursor(VncConnection *conn, guint16 x, guint16
             if (!vnc_connection_validate_boundary(conn, fb,
                                                   0, 0, width, height))
                 break;
-            vnc_connection_raw_update(conn, fb, 0, 0, width, height);
+            vnc_connection_raw_update(conn, fb, &fmt, 0, 0, width, height);
             break;
         case VNC_CONNECTION_ENCODING_COPY_RECT:
             if (!vnc_connection_validate_boundary(conn, fb,
@@ -3221,25 +3232,25 @@ static void vnc_connection_alpha_cursor(VncConnection *conn, guint16 x, guint16
             if (!vnc_connection_validate_boundary(conn, fb,
                                                   0, 0, width, height))
                 break;
-            vnc_connection_rre_update(conn, fb, 0, 0, width, height);
+            vnc_connection_rre_update(conn, fb, &fmt, 0, 0, width, height);
             break;
         case VNC_CONNECTION_ENCODING_HEXTILE:
             if (!vnc_connection_validate_boundary(conn, fb,
                                                   0, 0, width, height))
                 break;
-            vnc_connection_hextile_update(conn, fb, 0, 0, width, height);
+            vnc_connection_hextile_update(conn, fb, &fmt, 0, 0, width, height);
             break;
         case VNC_CONNECTION_ENCODING_ZRLE:
             if (!vnc_connection_validate_boundary(conn, fb,
                                                   0, 0, width, height))
                 break;
-            vnc_connection_zrle_update(conn, fb, 0, 0, width, height);
+            vnc_connection_zrle_update(conn, fb, &fmt, 0, 0, width, height);
             break;
         case VNC_CONNECTION_ENCODING_TIGHT:
             if (!vnc_connection_validate_boundary(conn, fb,
                                                   0, 0, width, height))
                 break;
-            vnc_connection_tight_update(conn, fb, 0, 0, width, height);
+            vnc_connection_tight_update(conn, fb, &fmt, 0, 0, width, height);
             break;
         default:
             vnc_connection_set_error(conn,
@@ -3341,7 +3352,7 @@ static gboolean vnc_connection_framebuffer_update(VncConnection *conn, gint32 et
         if (!vnc_connection_validate_boundary(conn, priv->fb,
                                               x, y, width, height))
             break;
-        vnc_connection_raw_update(conn, priv->fb, x, y, width, height);
+        vnc_connection_raw_update(conn, priv->fb, &priv->fmt, x, y, width, height);
         vnc_connection_update(conn, x, y, width, height);
         break;
     case VNC_CONNECTION_ENCODING_COPY_RECT:
@@ -3355,28 +3366,28 @@ static gboolean vnc_connection_framebuffer_update(VncConnection *conn, gint32 et
         if (!vnc_connection_validate_boundary(conn, priv->fb,
                                               x, y, width, height))
             break;
-        vnc_connection_rre_update(conn, priv->fb, x, y, width, height);
+        vnc_connection_rre_update(conn, priv->fb, &priv->fmt, x, y, width, height);
         vnc_connection_update(conn, x, y, width, height);
         break;
     case VNC_CONNECTION_ENCODING_HEXTILE:
         if (!vnc_connection_validate_boundary(conn, priv->fb,
                                               x, y, width, height))
             break;
-        vnc_connection_hextile_update(conn, priv->fb, x, y, width, height);
+        vnc_connection_hextile_update(conn, priv->fb, &priv->fmt, x, y, width, height);
         vnc_connection_update(conn, x, y, width, height);
         break;
     case VNC_CONNECTION_ENCODING_ZRLE:
         if (!vnc_connection_validate_boundary(conn, priv->fb,
                                               x, y, width, height))
             break;
-        vnc_connection_zrle_update(conn, priv->fb, x, y, width, height);
+        vnc_connection_zrle_update(conn, priv->fb, &priv->fmt, x, y, width, height);
         vnc_connection_update(conn, x, y, width, height);
         break;
     case VNC_CONNECTION_ENCODING_TIGHT:
         if (!vnc_connection_validate_boundary(conn, priv->fb,
                                               x, y, width, height))
             break;
-        vnc_connection_tight_update(conn, priv->fb, x, y, width, height);
+        vnc_connection_tight_update(conn, priv->fb, &priv->fmt, x, y, width, height);
         vnc_connection_update(conn, x, y, width, height);
         break;
     case VNC_CONNECTION_ENCODING_DESKTOP_RESIZE:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]