File Do-not-assume-framebuffer-and-scanlines-are-32bit-aligned.patch of Package krdc

From 8491d4320a13413f1b06a991c7c6728e617a1542 Mon Sep 17 00:00:00 2001
From: Luca Carlon <carlon.luca@gmail.com>
Date: Sat, 20 Apr 2019 11:26:21 +0200
Subject: Do not assume framebuffer and scalines are always 32-bit aligned

Summary:
When server resolution is 1366x768 and 8-bit depth is requested, this is what I get:

{F6734981}

Looking at the code, it seems that once QImage is initialized from framebuffer data, the used ctor expects the buffer and each scanline to be 32-bit aligned: https://doc.qt.io/Qt-5/qimage.html#QImage-3. Providing the stride explicitly this is what I get:

{F6734992}

Reviewers: uwolfer

Reviewed By: uwolfer

Differential Revision: https://phabricator.kde.org/D20123
---
 vnc/vncclientthread.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vnc/vncclientthread.cpp b/vnc/vncclientthread.cpp
index e2dffd1..b6b6ab1 100644
--- a/vnc/vncclientthread.cpp
+++ b/vnc/vncclientthread.cpp
@@ -190,14 +190,14 @@ void VncClientThread::updatefb(int x, int y, int w, int h)
     QImage img;
     switch(colorDepth()) {
     case bpp8:
-        img = QImage(cl->frameBuffer, width, height, QImage::Format_Indexed8);
+        img = QImage(cl->frameBuffer, width, height, width, QImage::Format_Indexed8);
         img.setColorTable(m_colorTable);
         break;
     case bpp16:
-        img = QImage(cl->frameBuffer, width, height, QImage::Format_RGB16);
+        img = QImage(cl->frameBuffer, width, height, 2*width, QImage::Format_RGB16);
         break;
     case bpp32:
-        img = QImage(cl->frameBuffer, width, height, QImage::Format_RGB32);
+        img = QImage(cl->frameBuffer, width, height, 4*width, QImage::Format_RGB32);
         break;
     }
 
-- 
cgit v1.1

openSUSE Build Service is sponsored by