| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | #include "qxcbimage.h" | - |
| 41 | #include <QtGui/QColor> | - |
| 42 | #include <QtGui/private/qimage_p.h> | - |
| 43 | #include <QtGui/private/qdrawhelper_p.h> | - |
| 44 | #ifdef XCB_USE_RENDER | - |
| 45 | #include <xcb/render.h> | - |
| 46 | | - |
| 47 | #define template template_param | - |
| 48 | | - |
| 49 | extern "C" { | - |
| 50 | #include <xcb/xcb_renderutil.h> | - |
| 51 | } | - |
| 52 | #undef template | - |
| 53 | #endif | - |
| 54 | | - |
| 55 | QT_BEGIN_NAMESPACE | - |
| 56 | | - |
| 57 | QImage::Format qt_xcb_imageFormatForVisual(QXcbConnection *connection, uint8_t depth, | - |
| 58 | const xcb_visualtype_t *visual) | - |
| 59 | { | - |
| 60 | const xcb_format_t *format = connection->formatForDepth(depth); | - |
| 61 | | - |
| 62 | if (!visual || !format)| TRUE | never evaluated | | FALSE | evaluated 72831 times by 105 testsEvaluated by:- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractScrollArea
- tst_QAccessibility
- tst_QApplication
- tst_QBoxLayout
- tst_QBrush
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QCompleter
- tst_QDataStream
- tst_QDateTimeEdit
- tst_QDialog
- tst_QDialogButtonBox
- tst_QDockWidget
- tst_QDoubleSpinBox
- tst_QErrorMessage
- tst_QFileDialog2
- tst_QFileIconProvider
- tst_QFileSystemModel
- tst_QFiledialog
- ...
|
| TRUE | never evaluated | | FALSE | evaluated 72831 times by 105 testsEvaluated by:- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractScrollArea
- tst_QAccessibility
- tst_QApplication
- tst_QBoxLayout
- tst_QBrush
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QCompleter
- tst_QDataStream
- tst_QDateTimeEdit
- tst_QDialog
- tst_QDialogButtonBox
- tst_QDockWidget
- tst_QDoubleSpinBox
- tst_QErrorMessage
- tst_QFileDialog2
- tst_QFileIconProvider
- tst_QFileSystemModel
- tst_QFiledialog
- ...
|
| 0-72831 |
| 63 | return QImage::Format_Invalid; never executed: return QImage::Format_Invalid; | 0 |
| 64 | | - |
| 65 | if (depth == 32 && format->bits_per_pixel == 32 && visual->red_mask == 0xff0000| TRUE | never evaluated | | FALSE | evaluated 72831 times by 105 testsEvaluated by:- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractScrollArea
- tst_QAccessibility
- tst_QApplication
- tst_QBoxLayout
- tst_QBrush
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QCompleter
- tst_QDataStream
- tst_QDateTimeEdit
- tst_QDialog
- tst_QDialogButtonBox
- tst_QDockWidget
- tst_QDoubleSpinBox
- tst_QErrorMessage
- tst_QFileDialog2
- tst_QFileIconProvider
- tst_QFileSystemModel
- tst_QFiledialog
- ...
|
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-72831 |
| 66 | && visual->green_mask == 0xff00 && visual->blue_mask == 0xff)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 67 | return QImage::Format_ARGB32_Premultiplied; never executed: return QImage::Format_ARGB32_Premultiplied; | 0 |
| 68 | | - |
| 69 | if (depth == 30 && format->bits_per_pixel == 32 && visual->red_mask == 0x3ff| TRUE | never evaluated | | FALSE | evaluated 72831 times by 105 testsEvaluated by:- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractScrollArea
- tst_QAccessibility
- tst_QApplication
- tst_QBoxLayout
- tst_QBrush
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QCompleter
- tst_QDataStream
- tst_QDateTimeEdit
- tst_QDialog
- tst_QDialogButtonBox
- tst_QDockWidget
- tst_QDoubleSpinBox
- tst_QErrorMessage
- tst_QFileDialog2
- tst_QFileIconProvider
- tst_QFileSystemModel
- tst_QFiledialog
- ...
|
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-72831 |
| 70 | && visual->green_mask == 0x0ffc00 && visual->blue_mask == 0x3ff00000)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 71 | return QImage::Format_BGR30; never executed: return QImage::Format_BGR30; | 0 |
| 72 | | - |
| 73 | if (depth == 30 && format->bits_per_pixel == 32 && visual->blue_mask == 0x3ff| TRUE | never evaluated | | FALSE | evaluated 72831 times by 105 testsEvaluated by:- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractScrollArea
- tst_QAccessibility
- tst_QApplication
- tst_QBoxLayout
- tst_QBrush
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QCompleter
- tst_QDataStream
- tst_QDateTimeEdit
- tst_QDialog
- tst_QDialogButtonBox
- tst_QDockWidget
- tst_QDoubleSpinBox
- tst_QErrorMessage
- tst_QFileDialog2
- tst_QFileIconProvider
- tst_QFileSystemModel
- tst_QFiledialog
- ...
|
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-72831 |
| 74 | && visual->green_mask == 0x0ffc00 && visual->red_mask == 0x3ff00000)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 75 | return QImage::Format_RGB30; never executed: return QImage::Format_RGB30; | 0 |
| 76 | | - |
| 77 | if (depth == 24 && format->bits_per_pixel == 32 && visual->red_mask == 0xff0000| TRUE | evaluated 72831 times by 105 testsEvaluated by:- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractScrollArea
- tst_QAccessibility
- tst_QApplication
- tst_QBoxLayout
- tst_QBrush
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QCompleter
- tst_QDataStream
- tst_QDateTimeEdit
- tst_QDialog
- tst_QDialogButtonBox
- tst_QDockWidget
- tst_QDoubleSpinBox
- tst_QErrorMessage
- tst_QFileDialog2
- tst_QFileIconProvider
- tst_QFileSystemModel
- tst_QFiledialog
- ...
| | FALSE | never evaluated |
| TRUE | evaluated 72831 times by 105 testsEvaluated by:- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractScrollArea
- tst_QAccessibility
- tst_QApplication
- tst_QBoxLayout
- tst_QBrush
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QCompleter
- tst_QDataStream
- tst_QDateTimeEdit
- tst_QDialog
- tst_QDialogButtonBox
- tst_QDockWidget
- tst_QDoubleSpinBox
- tst_QErrorMessage
- tst_QFileDialog2
- tst_QFileIconProvider
- tst_QFileSystemModel
- tst_QFiledialog
- ...
| | FALSE | never evaluated |
| TRUE | evaluated 72831 times by 105 testsEvaluated by:- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractScrollArea
- tst_QAccessibility
- tst_QApplication
- tst_QBoxLayout
- tst_QBrush
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QCompleter
- tst_QDataStream
- tst_QDateTimeEdit
- tst_QDialog
- tst_QDialogButtonBox
- tst_QDockWidget
- tst_QDoubleSpinBox
- tst_QErrorMessage
- tst_QFileDialog2
- tst_QFileIconProvider
- tst_QFileSystemModel
- tst_QFiledialog
- ...
| | FALSE | never evaluated |
| 0-72831 |
| 78 | && visual->green_mask == 0xff00 && visual->blue_mask == 0xff)| TRUE | evaluated 72831 times by 105 testsEvaluated by:- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractScrollArea
- tst_QAccessibility
- tst_QApplication
- tst_QBoxLayout
- tst_QBrush
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QCompleter
- tst_QDataStream
- tst_QDateTimeEdit
- tst_QDialog
- tst_QDialogButtonBox
- tst_QDockWidget
- tst_QDoubleSpinBox
- tst_QErrorMessage
- tst_QFileDialog2
- tst_QFileIconProvider
- tst_QFileSystemModel
- tst_QFiledialog
- ...
| | FALSE | never evaluated |
| TRUE | evaluated 72831 times by 105 testsEvaluated by:- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractScrollArea
- tst_QAccessibility
- tst_QApplication
- tst_QBoxLayout
- tst_QBrush
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QCompleter
- tst_QDataStream
- tst_QDateTimeEdit
- tst_QDialog
- tst_QDialogButtonBox
- tst_QDockWidget
- tst_QDoubleSpinBox
- tst_QErrorMessage
- tst_QFileDialog2
- tst_QFileIconProvider
- tst_QFileSystemModel
- tst_QFiledialog
- ...
| | FALSE | never evaluated |
| 0-72831 |
| 79 | return QImage::Format_RGB32;executed 72831 times by 105 tests: return QImage::Format_RGB32;Executed by:- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractScrollArea
- tst_QAccessibility
- tst_QApplication
- tst_QBoxLayout
- tst_QBrush
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QCompleter
- tst_QDataStream
- tst_QDateTimeEdit
- tst_QDialog
- tst_QDialogButtonBox
- tst_QDockWidget
- tst_QDoubleSpinBox
- tst_QErrorMessage
- tst_QFileDialog2
- tst_QFileIconProvider
- tst_QFileSystemModel
- tst_QFiledialog
- ...
| 72831 |
| 80 | | - |
| 81 | if (depth == 16 && format->bits_per_pixel == 16 && visual->red_mask == 0xf800| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 82 | && visual->green_mask == 0x7e0 && visual->blue_mask == 0x1f)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 83 | return QImage::Format_RGB16; never executed: return QImage::Format_RGB16; | 0 |
| 84 | | - |
| 85 | return QImage::Format_Invalid; never executed: return QImage::Format_Invalid; | 0 |
| 86 | } | - |
| 87 | | - |
| 88 | QPixmap qt_xcb_pixmapFromXPixmap(QXcbConnection *connection, xcb_pixmap_t pixmap, | - |
| 89 | int width, int height, int depth, | - |
| 90 | const xcb_visualtype_t *visual) | - |
| 91 | { | - |
| 92 | xcb_connection_t *conn = connection->xcb_connection(); | - |
| 93 | | - |
| 94 | xcb_get_image_cookie_t get_image_cookie = | - |
| 95 | xcb_get_image_unchecked(conn, XCB_IMAGE_FORMAT_Z_PIXMAP, pixmap, | - |
| 96 | 0, 0, width, height, 0xffffffff); | - |
| 97 | | - |
| 98 | xcb_get_image_reply_t *image_reply = | - |
| 99 | xcb_get_image_reply(conn, get_image_cookie, NULL); | - |
| 100 | | - |
| 101 | if (!image_reply) {| TRUE | never evaluated | | FALSE | evaluated 22 times by 3 testsEvaluated by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
|
| 0-22 |
| 102 | return QPixmap(); never executed: return QPixmap(); | 0 |
| 103 | } | - |
| 104 | | - |
| 105 | uint8_t *data = xcb_get_image_data(image_reply); | - |
| 106 | uint32_t length = xcb_get_image_data_length(image_reply); | - |
| 107 | | - |
| 108 | QPixmap result; | - |
| 109 | | - |
| 110 | QImage::Format format = qt_xcb_imageFormatForVisual(connection, depth, visual); | - |
| 111 | if (format != QImage::Format_Invalid) {| TRUE | evaluated 22 times by 3 testsEvaluated by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
| | FALSE | never evaluated |
| 0-22 |
| 112 | uint32_t bytes_per_line = length / height; | - |
| 113 | QImage image(const_cast<uint8_t *>(data), width, height, bytes_per_line, format); | - |
| 114 | uint8_t image_byte_order = connection->setup()->image_byte_order; | - |
| 115 | | - |
| 116 | | - |
| 117 | if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST)| TRUE | evaluated 22 times by 3 testsEvaluated by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
| | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 22 times by 3 testsEvaluated by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
|
| 0-22 |
| 118 | || (QSysInfo::ByteOrder == QSysInfo::BigEndian && image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST))| TRUE | never evaluated | | FALSE | evaluated 22 times by 3 testsEvaluated by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
|
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-22 |
| 119 | { | - |
| 120 | for (int i=0; i < image.height(); i++) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 121 | switch (format) { | - |
| 122 | case QImage::Format_RGB16: { never executed: case QImage::Format_RGB16: | 0 |
| 123 | ushort *p = (ushort*)image.scanLine(i); | - |
| 124 | ushort *end = p + image.width(); | - |
| 125 | while (p < end) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 126 | *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); | - |
| 127 | p++; | - |
| 128 | } never executed: end of block | 0 |
| 129 | break; never executed: break; | 0 |
| 130 | } | - |
| 131 | case QImage::Format_RGB32: never executed: case QImage::Format_RGB32: | 0 |
| 132 | case QImage::Format_ARGB32_Premultiplied: { never executed: case QImage::Format_ARGB32_Premultiplied: | 0 |
| 133 | uint *p = (uint*)image.scanLine(i); | - |
| 134 | uint *end = p + image.width(); | - |
| 135 | while (p < end) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 136 | *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) | - |
| 137 | | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); | - |
| 138 | p++; | - |
| 139 | } never executed: end of block | 0 |
| 140 | break; never executed: break; | 0 |
| 141 | } | - |
| 142 | default: never executed: default: | 0 |
| 143 | Q_ASSERT(false); | - |
| 144 | } never executed: end of block | 0 |
| 145 | } | - |
| 146 | } never executed: end of block | 0 |
| 147 | | - |
| 148 | | - |
| 149 | if (format == QImage::Format_RGB32) {| TRUE | evaluated 22 times by 3 testsEvaluated by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
| | FALSE | never evaluated |
| 0-22 |
| 150 | QRgb *p = (QRgb *)image.bits(); | - |
| 151 | for (int y = 0; y < height; ++y) {| TRUE | evaluated 1856 times by 3 testsEvaluated by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
| | FALSE | evaluated 22 times by 3 testsEvaluated by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
|
| 22-1856 |
| 152 | for (int x = 0; x < width; ++x)| TRUE | evaluated 487578 times by 3 testsEvaluated by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
| | FALSE | evaluated 1856 times by 3 testsEvaluated by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
|
| 1856-487578 |
| 153 | p[x] |= 0xff000000;executed 487578 times by 3 tests: p[x] |= 0xff000000;Executed by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
| 487578 |
| 154 | p += bytes_per_line / 4; | - |
| 155 | }executed 1856 times by 3 tests: end of blockExecuted by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
| 1856 |
| 156 | } else if (format == QImage::Format_BGR30 || format == QImage::Format_RGB30) {executed 22 times by 3 tests: end of blockExecuted by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-22 |
| 157 | QRgb *p = (QRgb *)image.bits(); | - |
| 158 | for (int y = 0; y < height; ++y) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 159 | for (int x = 0; x < width; ++x)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 160 | p[x] |= 0xc0000000; never executed: p[x] |= 0xc0000000; | 0 |
| 161 | p += bytes_per_line / 4; | - |
| 162 | } never executed: end of block | 0 |
| 163 | } never executed: end of block | 0 |
| 164 | | - |
| 165 | result = QPixmap::fromImage(image.copy()); | - |
| 166 | }executed 22 times by 3 tests: end of blockExecuted by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
| 22 |
| 167 | | - |
| 168 | free(image_reply); | - |
| 169 | return result;executed 22 times by 3 tests: return result;Executed by:- tst_QOpenGLWidget
- tst_QToolTip
- tst_QWidget
| 22 |
| 170 | } | - |
| 171 | | - |
| 172 | xcb_pixmap_t qt_xcb_XPixmapFromBitmap(QXcbScreen *screen, const QImage &image) | - |
| 173 | { | - |
| 174 | xcb_connection_t *conn = screen->xcb_connection(); | - |
| 175 | QImage bitmap = image.convertToFormat(QImage::Format_MonoLSB); | - |
| 176 | const QRgb c0 = QColor(Qt::black).rgb(); | - |
| 177 | const QRgb c1 = QColor(Qt::white).rgb(); | - |
| 178 | if (bitmap.color(0) == c0 && bitmap.color(1) == c1) {| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 179 | bitmap.invertPixels(); | - |
| 180 | bitmap.setColor(0, c1); | - |
| 181 | bitmap.setColor(1, c0); | - |
| 182 | } never executed: end of block | 0 |
| 183 | const int width = bitmap.width(); | - |
| 184 | const int height = bitmap.height(); | - |
| 185 | const int bytesPerLine = bitmap.bytesPerLine(); | - |
| 186 | int destLineSize = width / 8; | - |
| 187 | if (width % 8)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 188 | ++destLineSize; never executed: ++destLineSize; | 0 |
| 189 | const uchar *map = bitmap.bits(); | - |
| 190 | uint8_t *buf = new uint8_t[height * destLineSize]; | - |
| 191 | for (int i = 0; i < height; i++)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 192 | memcpy(buf + (destLineSize * i), map + (bytesPerLine * i), destLineSize); never executed: memcpy(buf + (destLineSize * i), map + (bytesPerLine * i), destLineSize); | 0 |
| 193 | xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, screen->root(), buf, | - |
| 194 | width, height, 1, 0, 0, 0); | - |
| 195 | delete[] buf; | - |
| 196 | return pm; never executed: return pm; | 0 |
| 197 | } | - |
| 198 | | - |
| 199 | xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage &image, | - |
| 200 | const QPoint &spot) | - |
| 201 | { | - |
| 202 | #ifdef XCB_USE_RENDER | - |
| 203 | xcb_connection_t *conn = screen->xcb_connection(); | - |
| 204 | const int w = image.width(); | - |
| 205 | const int h = image.height(); | - |
| 206 | xcb_generic_error_t *error = 0; | - |
| 207 | xcb_render_query_pict_formats_cookie_t formatsCookie = xcb_render_query_pict_formats(conn); | - |
| 208 | xcb_render_query_pict_formats_reply_t *formatsReply = xcb_render_query_pict_formats_reply(conn, | - |
| 209 | formatsCookie, | - |
| 210 | &error); | - |
| 211 | if (!formatsReply || error) {| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 212 | qWarning("qt_xcb_createCursorXRender: query_pict_formats failed"); | - |
| 213 | free(formatsReply); | - |
| 214 | free(error); | - |
| 215 | return XCB_NONE; never executed: return 0L; | 0 |
| 216 | } | - |
| 217 | xcb_render_pictforminfo_t *fmt = xcb_render_util_find_standard_format(formatsReply, | - |
| 218 | XCB_PICT_STANDARD_ARGB_32); | - |
| 219 | if (!fmt) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 220 | qWarning("qt_xcb_createCursorXRender: Failed to find format PICT_STANDARD_ARGB_32"); | - |
| 221 | free(formatsReply); | - |
| 222 | return XCB_NONE; never executed: return 0L; | 0 |
| 223 | } | - |
| 224 | | - |
| 225 | QImage img = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); | - |
| 226 | xcb_image_t *xi = xcb_image_create(w, h, XCB_IMAGE_FORMAT_Z_PIXMAP, | - |
| 227 | 32, 32, 32, 32, | - |
| 228 | QSysInfo::ByteOrder == QSysInfo::BigEndian ? XCB_IMAGE_ORDER_MSB_FIRST : XCB_IMAGE_ORDER_LSB_FIRST, | - |
| 229 | XCB_IMAGE_ORDER_MSB_FIRST, | - |
| 230 | 0, 0, 0); | - |
| 231 | if (!xi) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 232 | qWarning("qt_xcb_createCursorXRender: xcb_image_create failed"); | - |
| 233 | free(formatsReply); | - |
| 234 | return XCB_NONE; never executed: return 0L; | 0 |
| 235 | } | - |
| 236 | xi->data = (uint8_t *) malloc(xi->stride * h); | - |
| 237 | if (!xi->data) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 238 | qWarning("qt_xcb_createCursorXRender: Failed to malloc() image data"); | - |
| 239 | xcb_image_destroy(xi); | - |
| 240 | free(formatsReply); | - |
| 241 | return XCB_NONE; never executed: return 0L; | 0 |
| 242 | } | - |
| 243 | memcpy(xi->data, img.constBits(), img.byteCount()); | - |
| 244 | | - |
| 245 | xcb_pixmap_t pix = xcb_generate_id(conn); | - |
| 246 | xcb_create_pixmap(conn, 32, pix, screen->root(), w, h); | - |
| 247 | | - |
| 248 | xcb_render_picture_t pic = xcb_generate_id(conn); | - |
| 249 | xcb_render_create_picture(conn, pic, pix, fmt->id, 0, 0); | - |
| 250 | | - |
| 251 | xcb_gcontext_t gc = xcb_generate_id(conn); | - |
| 252 | xcb_create_gc(conn, gc, pix, 0, 0); | - |
| 253 | xcb_image_put(conn, pix, gc, xi, 0, 0, 0); | - |
| 254 | xcb_free_gc(conn, gc); | - |
| 255 | | - |
| 256 | xcb_cursor_t cursor = xcb_generate_id(conn); | - |
| 257 | xcb_render_create_cursor(conn, cursor, pic, spot.x(), spot.y()); | - |
| 258 | | - |
| 259 | free(xi->data); | - |
| 260 | xcb_image_destroy(xi); | - |
| 261 | xcb_render_free_picture(conn, pic); | - |
| 262 | xcb_free_pixmap(conn, pix); | - |
| 263 | free(formatsReply); | - |
| 264 | return cursor; never executed: return cursor; | 0 |
| 265 | | - |
| 266 | #else | - |
| 267 | Q_UNUSED(screen); | - |
| 268 | Q_UNUSED(image); | - |
| 269 | Q_UNUSED(spot); | - |
| 270 | return XCB_NONE; | - |
| 271 | #endif | - |
| 272 | } | - |
| 273 | | - |
| 274 | QT_END_NAMESPACE | - |
| | |