0002-fix-VNC-platform-plugin-build-on-big-endian-machines.patch 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. From 35ee8b53549fab6ebffe289417e1d94298447af7 Mon Sep 17 00:00:00 2001
  2. From: Shawn Rutledge <shawn.rutledge@digia.com>
  3. Date: Fri, 10 Feb 2017 13:56:58 +0100
  4. Subject: [PATCH] fix VNC platform plugin build on big-endian machines
  5. Task-number: QTBUG-58734
  6. Change-Id: I3e44ee4be5003acaba2f1b8ed2658a3ff1bd700e
  7. Reviewed-by: Lars Knoll <lars.knoll@qt.io>
  8. Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
  9. Upstream: http://code.qt.io/cgit/qt/qtbase.git/patch/?id=6f64bfa654fb7e20bb75ec3b0544b81482babb44
  10. Signed-off-by: Peter Seiderer <ps.report@gmx.net>
  11. ---
  12. src/plugins/platforms/vnc/qvncclient.cpp | 6 +++---
  13. src/plugins/platforms/vnc/qvncscreen.cpp | 7 ++++++-
  14. src/plugins/platforms/vnc/qvncscreen.h | 2 +-
  15. 3 files changed, 10 insertions(+), 5 deletions(-)
  16. diff --git a/src/plugins/platforms/vnc/qvncclient.cpp b/src/plugins/platforms/vnc/qvncclient.cpp
  17. index dae3e83f..58dcfc9b 100644
  18. --- a/src/plugins/platforms/vnc/qvncclient.cpp
  19. +++ b/src/plugins/platforms/vnc/qvncclient.cpp
  20. @@ -142,7 +142,7 @@ void QVncClient::convertPixels(char *dst, const char *src, int count) const
  21. case 16: {
  22. quint16 p = *reinterpret_cast<const quint16*>(src);
  23. #if Q_BYTE_ORDER == Q_BIG_ENDIAN
  24. - if (swapBytes)
  25. + if (m_swapBytes)
  26. p = ((p & 0xff) << 8) | ((p & 0xff00) >> 8);
  27. #endif
  28. r = (p >> 11) & 0x1f;
  29. @@ -484,7 +484,7 @@ void QVncClient::setPixelFormat()
  30. m_sameEndian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) == !!m_pixelFormat.bigEndian;
  31. m_needConversion = pixelConversionNeeded();
  32. #if Q_BYTE_ORDER == Q_BIG_ENDIAN
  33. - m_swapBytes = qvnc_screen->swapBytes();
  34. + m_swapBytes = server()->screen()->swapBytes();
  35. #endif
  36. }
  37. }
  38. @@ -639,7 +639,7 @@ bool QVncClient::pixelConversionNeeded() const
  39. return true;
  40. #if Q_BYTE_ORDER == Q_BIG_ENDIAN
  41. - if (qvnc_screen->swapBytes())
  42. + if (server()->screen()->swapBytes())
  43. return true;
  44. #endif
  45. diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp
  46. index 34def457..64f1bc0b 100644
  47. --- a/src/plugins/platforms/vnc/qvncscreen.cpp
  48. +++ b/src/plugins/platforms/vnc/qvncscreen.cpp
  49. @@ -43,6 +43,7 @@
  50. #include <QtFbSupport/private/qfbcursor_p.h>
  51. #include <QtGui/QPainter>
  52. +#include <QtGui/QScreen>
  53. #include <QtCore/QRegularExpression>
  54. @@ -172,14 +173,18 @@ QPixmap QVncScreen::grabWindow(WId wid, int x, int y, int width, int height) con
  55. }
  56. #if Q_BYTE_ORDER == Q_BIG_ENDIAN
  57. -bool QVNCScreen::swapBytes() const
  58. +bool QVncScreen::swapBytes() const
  59. {
  60. + return false;
  61. +
  62. + /* TODO
  63. if (depth() != 16)
  64. return false;
  65. if (screen())
  66. return screen()->frameBufferLittleEndian();
  67. return frameBufferLittleEndian();
  68. + */
  69. }
  70. #endif
  71. diff --git a/src/plugins/platforms/vnc/qvncscreen.h b/src/plugins/platforms/vnc/qvncscreen.h
  72. index 785abd6d..0b42c3c7 100644
  73. --- a/src/plugins/platforms/vnc/qvncscreen.h
  74. +++ b/src/plugins/platforms/vnc/qvncscreen.h
  75. @@ -73,7 +73,7 @@ public:
  76. void clearDirty() { dirtyRegion = QRegion(); }
  77. #if Q_BYTE_ORDER == Q_BIG_ENDIAN
  78. - bool swapBytes() const
  79. + bool swapBytes() const;
  80. #endif
  81. QStringList mArgs;
  82. --
  83. 2.11.0