[gtk-vnc] src: fix pixel shifts in rgb24_blt functions



commit c09a8124673f23b4672c8c9ce00fa1fe8c3abfb1
Author: Daniel P. Berrangé <dan berrange com>
Date:   Thu Apr 1 00:36:33 2021 +0100

    src: fix pixel shifts in rgb24_blt functions
    
    The src pixel is always rgb24 format, regardless of what the
    remote pixel format is, so we should not be using the remote
    pixel shifts.
    
    Fixes https://gitlab.gnome.org/GNOME/gtk-vnc/-/issues/14
    Signed-off-by: Daniel P. Berrangé <berrange redhat com>

 src/vncbaseframebufferblt.h | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
---
diff --git a/src/vncbaseframebufferblt.h b/src/vncbaseframebufferblt.h
index 9e78f80..2823f16 100644
--- a/src/vncbaseframebufferblt.h
+++ b/src/vncbaseframebufferblt.h
@@ -177,14 +177,7 @@ static void RGB24_BLT(VncBaseFramebufferPrivate *priv,
         guint8 *sp = src;
 
         for (i = 0; i < width; i++) {
-            /*
-             * We use priv->remoteFormat->XXX_shift instead of usual priv->Xls
-             * because the source pixel component is a full 8 bits in
-             * size, and so doesn't need the adjusted shift
-             */
-            *dp = (((sp[0] * priv->remoteFormat->red_max) / 255) << priv->remoteFormat->red_shift) |
-                (((sp[1] * priv->remoteFormat->green_max) / 255) << priv->remoteFormat->green_shift) |
-                (((sp[2] * priv->remoteFormat->blue_max) / 255) << priv->remoteFormat->blue_shift);
+            *dp = (sp[0] << 16 | sp[1] << 8 | sp[2]);
             dp++;
             sp += 3;
         }


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