5#include <QGuiApplication>
7#include <private/qdrawhelper_p.h>
8#include <private/qimage_p.h>
9#include <private/qimagepixmapcleanuphooks_p.h>
18#if QT_POINTER_SIZE == 8
20Q_ALWAYS_INLINE uint PREMUL(uint x) {
22 quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
23 t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8;
24 t &= 0x000000ff00ff00ff;
25 return (uint(t)) | (uint(t >> 24)) | (a << 24);
30Q_ALWAYS_INLINE uint PREMUL(uint x) {
32 uint t = (x & 0xff00ff) * a;
33 t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
36 x = ((x >> 8) & 0xff) * a;
37 x = (x + ((x >> 8) & 0xff) + 0x80);
53 QPlatformPixmap *data =
54 new QX11PlatformPixmap(image.depth() == 1
55 ? QPlatformPixmap::BitmapType
56 : QPlatformPixmap::PixmapType);
58 data->fromImage(image, Qt::AutoColor);
68 if (QPixmap(pixmap).data_ptr()->classId() == QPlatformPixmap::X11Class)
71 return qt_toX11Pixmap(pixmap.toImage());
96 that->width(), that->height(), 0, 0);
106 is_null = (w <= 0 || h <= 0);
107 hd = createBitmapFromImage(image);
108#if QT_CONFIG(xrender)
109 if (X11->use_xrender)
110 picture = XRenderCreatePicture(xinfo.display(), hd,
111 XRenderFindStandardFormat(xinfo.display(), PictStandardA1), 0, 0);
117 XImage *xi = xiWrapper
.xi;
119 if (xi->format != ZPixmap)
123 if (picture && depth() == 32)
127 if (depth() == 24 && xi->bits_per_pixel == 32 && xi->red_mask == 0xff0000
128 && xi->green_mask == 0xff00 && xi->blue_mask == 0xff)
132 if (depth() == 16 && xi->bits_per_pixel == 16 && xi->red_mask == 0xf800
133 && xi->green_mask == 0x7e0 && xi->blue_mask == 0x1f)
141 XImage *xi = xiWrapper
.xi;
143 QImage::Format format = QImage::Format_ARGB32_Premultiplied;
145 format = QImage::Format_RGB32;
146 else if (depth() == 16)
147 format = QImage::Format_RGB16;
149 QImage image((uchar *)xi->data, xi->width, xi->height, xi->bytes_per_line, format);
150 image.setDevicePixelRatio(devicePixelRatio());
152 image.data_ptr()->own_data =
true;
156 if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst)
157 || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst))
159 for (
int i=0; i < image.height(); i++) {
161 ushort *p = (ushort*)image.scanLine(i);
162 ushort *end = p + image.width();
164 *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff);
168 uint *p = (uint*)image.scanLine(i);
169 uint *end = p + image.width();
171 *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000)
172 | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff);
180 if (format == QImage::Format_RGB32) {
181 QRgb *p = (QRgb *)image.bits();
182 for (
int y = 0; y < xi->height; ++y) {
183 for (
int x = 0; x < xi->width; ++x)
185 p += xi->bytes_per_line / 4;
198 qt_x11SetScreen(bm, screen);
203 that->width(), that->height(), 1);
206 that->width(), that->height(), 0, 0);
216 if (pixmap.handle()->classId() != QPlatformPixmap::X11Class)
224
225
233 uint b = (uint)1 << 31;
234 for (i=31; ((b & v) == 0) && i>=0; i--)
262
263
264
268 qWarning(
"build_scale_table: internal error, nBits = %i", nBits);
272 static bool firstTable =
true;
277 *table =
new uint[256];
279 int maxVal = (1 << nBits) - 1;
280 int valShift = 8 - nBits;
282 for (i = 0 ; i < maxVal + 1 ; i++)
283 (*table)[i << valShift] = i*255/maxVal;
297 if (pixmap.paintingActive()) {
298 qWarning(
"qt_x11SetScreen(): Cannot change screens during painting");
305 if (pixmap.handle()->classId() != QPlatformPixmap::X11Class)
312 if (screen == pm->xinfo.screen())
315 if (pixmap.isNull()) {
321 qDebug(
"qt_x11SetScreen for %p from %d to %d. Size is %d/%d", pm, pm->xinfo.screen(), screen, pm->width(), pm->height());
325 pixmap = qt_toX11Pixmap(pixmap.toImage());
329
330
337 flags(Uninitialized), x11_mask(0), picture(0), mask_picture(0), hd2(0),
345 QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(
this);
355 p->setDevicePixelRatio(devicePixelRatio());
361 setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1));
365 is_null = (w <= 0 || h <= 0);
367 if (defaultScreen >= 0 && defaultScreen != xinfo.screen()) {
368 xinfo = QXcbX11Info::fromScreen(defaultScreen);
371 int dd = xinfo.depth();
373 if (qt_x11_preferred_pixmap_depth)
374 dd = qt_x11_preferred_pixmap_depth;
376 bool make_null = w <= 0 || h <= 0;
377 d = (pixelType() == BitmapType ? 1 : dd);
378 if (make_null || d == 0) {
386 qWarning(
"QPixmap: Invalid pixmap parameters");
389 hd = XCreatePixmap(xinfo.display(),
390 RootWindow(xinfo.display(), xinfo.screen()),
392#if QT_CONFIG(xrender)
393 if (X11->use_xrender) {
394 XRenderPictFormat *format = d == 1
395 ? XRenderFindStandardFormat(xinfo.display(), PictStandardA1)
396 : XRenderFindVisualFormat(xinfo.display(), (Visual *) xinfo.visual());
397 picture = XRenderCreatePicture(xinfo.display(), hd, format, 0, 0);
409 has = image->isNull() ?
false :
const_cast<QImage *>(image)->data_ptr()->checkForAlphaPixels();
422 if (flags & Qt::NoOpaqueDetection) {
424 has = image->hasAlphaChannel();
435 setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1));
440 is_null = (w <= 0 || h <= 0);
441 setDevicePixelRatio(img.devicePixelRatio());
448 if (defaultScreen >= 0 && defaultScreen != xinfo.screen()) {
449 xinfo = QXcbX11Info::fromScreen(defaultScreen);
452 if (pixelType() == BitmapType) {
453 bitmapFromImage(img);
457 if (uint(w) >= 32768 || uint(h) >= 32768) {
464 int dd = alphaCheck.hasXRenderAndAlpha() ? 32 : xinfo.depth();
466 if (qt_x11_preferred_pixmap_depth)
467 dd = qt_x11_preferred_pixmap_depth;
472 if (dd == 1 || (flags & Qt::ColorMode_Mask) == Qt::MonoOnly) {
475 image = image.convertToFormat(QImage::Format_MonoLSB, flags);
480 if (d > 8 && dd <= 8) {
481 if ((flags & Qt::DitherMode_Mask) == Qt::AutoDither)
482 flags = (flags & ~Qt::DitherMode_Mask)
485 }
else if ((flags & Qt::ColorMode_Mask) == Qt::ColorOnly) {
488 if (image.colorCount() == 2) {
489 QRgb c0 = image.color(0);
490 QRgb c1 = image.color(1);
491 conv8 = qMin(c0,c1) != qRgb(0,0,0) || qMax(c0,c1) != qRgb(255,255,255);
498 image = image.convertToFormat(QImage::Format_Indexed8, flags);
503 if (d == 1 || image.format() > QImage::Format_ARGB32_Premultiplied) {
504 QImage::Format fmt = QImage::Format_RGB32;
505 if (alphaCheck.hasXRenderAndAlpha() && d > 1)
506 fmt = QImage::Format_ARGB32_Premultiplied;
507 image = image.convertToFormat(fmt, flags);
508 fromImage(image, Qt::AutoColor);
512 Display *dpy = xinfo.display();
513 Visual *visual = (Visual *)xinfo.visual();
514 XImage *xi =
nullptr;
515 bool trucol = (visual->c_class >= TrueColor);
516 size_t nbytes = image.sizeInBytes();
517 uchar *newbits=
nullptr;
519#if QT_CONFIG(xrender)
520 if (alphaCheck.hasXRenderAndAlpha()) {
521 const QImage &cimage = image;
525 if (QXcbX11Info::appDepth() != d) {
529 hd = XCreatePixmap(dpy, RootWindow(dpy, xinfo.screen()), w, h, d);
530 picture = XRenderCreatePicture(dpy, hd,
531 XRenderFindStandardFormat(dpy, PictStandardARGB32), 0, 0);
533 xi = XCreateImage(dpy, visual, d, ZPixmap, 0, 0, w, h, 32, 0);
535 newbits = (uchar *)malloc(xi->bytes_per_line*h);
536 Q_CHECK_PTR(newbits);
537 xi->data = (
char *)newbits;
539 switch (cimage.format()) {
540 case QImage::Format_Indexed8: {
541 QList<QRgb> colorTable = cimage.colorTable();
542 uint *xidata = (uint *)xi->data;
543 for (
int y = 0; y < h; ++y) {
544 const uchar *p = cimage.scanLine(y);
545 for (
int x = 0; x < w; ++x) {
546 const QRgb rgb = colorTable[p[x]];
547 const int a = qAlpha(rgb);
552 *xidata = qRgba(qt_div_255(qRed(rgb) * a),
553 qt_div_255(qGreen(rgb) * a),
554 qt_div_255(qBlue(rgb) * a),
561 case QImage::Format_RGB32: {
562 uint *xidata = (uint *)xi->data;
563 for (
int y = 0; y < h; ++y) {
564 const QRgb *p = (
const QRgb *) cimage.scanLine(y);
565 for (
int x = 0; x < w; ++x)
566 *xidata++ = p[x] | 0xff000000;
570 case QImage::Format_ARGB32: {
571 uint *xidata = (uint *)xi->data;
572 for (
int y = 0; y < h; ++y) {
573 const QRgb *p = (
const QRgb *) cimage.scanLine(y);
574 for (
int x = 0; x < w; ++x) {
575 const QRgb rgb = p[x];
576 const int a = qAlpha(rgb);
581 *xidata = qRgba(qt_div_255(qRed(rgb) * a),
582 qt_div_255(qGreen(rgb) * a),
583 qt_div_255(qBlue(rgb) * a),
591 case QImage::Format_ARGB32_Premultiplied: {
592 uint *xidata = (uint *)xi->data;
593 for (
int y = 0; y < h; ++y) {
594 const QRgb *p = (
const QRgb *) cimage.scanLine(y);
595 memcpy(xidata, p, w*
sizeof(QRgb));
604 if ((xi->byte_order == MSBFirst) != (QSysInfo::ByteOrder == QSysInfo::BigEndian)) {
605 uint *xidata = (uint *)xi->data;
606 uint *xiend = xidata + w*h;
607 while (xidata < xiend) {
608 *xidata = (*xidata >> 24)
609 | ((*xidata >> 8) & 0xff00)
610 | ((*xidata << 8) & 0xff0000)
616 GC gc = XCreateGC(dpy, hd, 0, 0);
617 XPutImage(dpy, hd, gc, xi, 0, 0, 0, 0, w, h);
620 qSafeXDestroyImage(xi);
627 if (image.format() == QImage::Format_ARGB32_Premultiplied)
628 image = image.convertToFormat(QImage::Format_ARGB32);
630 const QImage &cimage = image;
632 const bool d8 = (d == 8);
633 const uint red_mask = (uint)visual->red_mask;
634 const uint green_mask = (uint)visual->green_mask;
635 const uint blue_mask = (uint)visual->blue_mask;
639 const uint rbits =
highest_bit(red_mask
) - lowest_bit(red_mask) + 1;
640 const uint gbits =
highest_bit(green_mask
) - lowest_bit(green_mask) + 1;
641 const uint bbits =
highest_bit(blue_mask
) - lowest_bit(blue_mask) + 1;
644 QList<QRgb> ctable = cimage.colorTable();
645 for (
int i=0; i < cimage.colorCount(); i++) {
646 int r = qRed (ctable[i]);
647 int g = qGreen(ctable[i]);
648 int b = qBlue (ctable[i]);
649 r = red_shift > 0 ? r << red_shift : r >> -red_shift;
650 g = green_shift > 0 ? g << green_shift : g >> -green_shift;
651 b = blue_shift > 0 ? b << blue_shift : b >> -blue_shift;
652 pix[i] = (b & blue_mask) | (g & green_mask) | (r & red_mask)
653 | ~(blue_mask | green_mask | red_mask);
657 xi = XCreateImage(dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0);
659 newbits = (uchar *)malloc(xi->bytes_per_line*h);
660 Q_CHECK_PTR(newbits);
663 int bppc = xi->bits_per_pixel;
665 bool contig_bits =
n_bits(red_mask
) == rbits &&
670 (flags & Qt::Dither_Mask) != Qt::ThresholdDither &&
671 (flags & Qt::DitherMode_Mask) != Qt::AvoidDither &&
677 static bool init=
false;
678 static int D[16][16];
679 if (dither_tc && !init) {
682
683
684
685
686
687
688
689
690
701 for (n=2; n<16; n*=2) {
702 for (i=0; i<n; i++) {
703 for (j=0; j<n; j++) {
707 D[i+n][j+n]=D[i][j]+1;
715 BPP16_565, BPP16_555,
716 BPP16_MSB, BPP16_LSB,
718 BPP24_MSB, BPP24_LSB,
723 bool same_msb_lsb = (xi->byte_order == MSBFirst) == (QSysInfo::ByteOrder == QSysInfo::BigEndian);
727 else if (bppc == 16) {
728 if (red_shift == 8 && green_shift == 3 && blue_shift == -3 && !d8 && same_msb_lsb)
730 else if (red_shift == 7 && green_shift == 2 && blue_shift == -3 && !d8 && same_msb_lsb)
733 mode = (xi->byte_order == LSBFirst) ? BPP16_LSB : BPP16_MSB;
734 }
else if (bppc == 24) {
735 if (red_shift == 16 && green_shift == 8 && blue_shift == 0 && !d8 && same_msb_lsb)
738 mode = (xi->byte_order == LSBFirst) ? BPP24_LSB : BPP24_MSB;
739 }
else if (bppc == 32) {
740 if (red_shift == 16 && green_shift == 8 && blue_shift == 0 && !d8 && same_msb_lsb)
743 mode = (xi->byte_order == LSBFirst) ? BPP32_LSB : BPP32_MSB;
745 qFatal(
"Logic error 3");
749 if (d8) pixel = pix[*src++];
753 int b = qBlue (*p++);
755 ? r << red_shift : r >> -red_shift;
757 ? g << green_shift : g >> -green_shift;
759 ? b << blue_shift : b >> -blue_shift;
760 pixel = (r & red_mask)|(g & green_mask) | (b & blue_mask)
761 | ~(blue_mask | green_mask | red_mask);
764#define GET_PIXEL_DITHER_TC
767 int b = qBlue (*p++);
768 const int thres = D[x%16
][y%16
];
769 if (r <= (255
-(1
<<(8
-rbits))) && ((r<<rbits) & 255
)
772 if (g <= (255
-(1
<<(8
-gbits))) && ((g<<gbits) & 255
)
775 if (b <= (255
-(1
<<(8
-bbits))) && ((b<<bbits) & 255
)
779 ? r << red_shift : r >> -red_shift;
781 ? g << green_shift : g >> -green_shift;
783 ? b << blue_shift : b >> -blue_shift;
784 uint pixel = (r & red_mask)|(g & green_mask) | (b & blue_mask);
788#define GET_PIXEL_DITHER_TC_OPT(red_shift,green_shift,blue_shift,red_mask,green_mask,blue_mask,
790 const int thres = D[x%16
][y%16
];
792 if (r <= (255
-(1
<<(8
-rbits))) && ((r<<rbits) & 255
)
796 if (g <= (255
-(1
<<(8
-gbits))) && ((g<<gbits) & 255
)
799 int b = qBlue (*p++);
800 if (b <= (255
-(1
<<(8
-bbits))) && ((b<<bbits) & 255
)
803 uint pixel = ((r red_shift) & red_mask)
804 | ((g green_shift) & green_mask)
805 | ((b blue_shift) & blue_mask);
808 for (int y=0
; y<h; y++) {
809 const uchar* src = cimage.scanLine(y);
810 uchar* dst = newbits + xi->bytes_per_line*y;
811 const QRgb* p = (const QRgb *)src;
819 quint16* dst16 = (quint16*)dst;
820 for (
int x=0; x<w; x++) {
828 quint16* dst16 = (quint16*)dst;
829 for (
int x=0; x<w; x++) {
837 for (
int x=0; x<w; x++) {
839 *dst++ = (pixel >> 8);
846 for (
int x=0; x<w; x++) {
854 qFatal(
"Logic error");
861 for (
int x=0; x<w; x++)
862 *dst++ = pix[*src++];
867 quint16* dst16 = (quint16*)dst;
868 for (
int x = 0; x < w; x++) {
869 *dst16++ = ((*p >> 8) & 0xf800)
870 | ((*p >> 5) & 0x7e0)
871 | ((*p >> 3) & 0x1f);
878 quint16* dst16 = (quint16*)dst;
879 for (
int x=0; x<w; x++) {
880 *dst16++ = ((*p >> 9) & 0x7c00)
881 | ((*p >> 6) & 0x3e0)
882 | ((*p >> 3) & 0x1f);
889 for (
int x=0; x<w; x++) {
891 *dst++ = (pixel >> 8);
898 for (
int x=0; x<w; x++) {
907 if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
908 for (
int x=0; x<w; x++) {
911 *dst++ = qBlue (*p++);
914 for (
int x=0; x<w; x++) {
917 *dst++ = qRed (*p++);
924 for (
int x=0; x<w; x++) {
926 *dst++ = pixel >> 16;
934 for (
int x=0; x<w; x++) {
938 *dst++ = pixel >> 16;
944 memcpy(dst, p, w * 4);
949 for (
int x=0; x<w; x++) {
951 *dst++ = pixel >> 24;
952 *dst++ = pixel >> 16;
960 for (
int x=0; x<w; x++) {
964 *dst++ = pixel >> 16;
965 *dst++ = pixel >> 24;
970 qFatal(
"Logic error 2");
973 xi->data = (
char *)newbits;
976 if (d == 8 && !trucol) {
979 if (image.colorCount() == 0)
980 image.setColorCount(1);
982 const QImage &cimage = image;
983 memset(pop, 0,
sizeof(
int)*256);
984 for (
int i = 0; i < h; i++) {
985 const uchar* p = cimage.scanLine(i);
986 const uchar *end = p + w;
991 newbits = (uchar *)malloc(nbytes);
992 Q_CHECK_PTR(newbits);
996 memcpy(p, cimage.bits(), nbytes);
999
1000
1001
1010 for (
int i=0; i< cimage.colorCount(); i++) {
1014 for (
int i = cimage.colorCount(); i < 256; i++)
1023 PIX pixarr_sorted[256];
1024 memset(pixarr, 0, ncols*
sizeof(PIX));
1025 PIX *px = &pixarr[0];
1029 QList<QRgb> ctable = cimage.colorTable();
1030 for (
int i = 0; i < 256; i++) {
1032 px->r = qRed (ctable[i]);
1033 px->g = qGreen(ctable[i]);
1034 px->b = qBlue (ctable[i]);
1037 if (pop[i] > maxpop) {
1042 px->mindist = 1000000;
1047 pixarr_sorted[0] = pixarr[maxpix];
1048 pixarr[maxpix].use = 0;
1050 for (
int i = 1; i < ncols; i++) {
1051 int minpix = -1, mindist = -1;
1052 px = &pixarr_sorted[i-1];
1057 if ((i & 1) || i<10) {
1058 for (
int j=0; j<ncols; j++) {
1061 dist = (px->r - r)*(px->r - r) +
1062 (px->g - g)*(px->g - g) +
1063 (px->b - b)*(px->b - b);
1064 if (px->mindist > dist)
1066 if (px->mindist > mindist) {
1067 mindist = px->mindist;
1073 for (
int j=0; j<ncols; j++) {
1076 dist = (px->r - r)*(px->r - r) +
1077 (px->g - g)*(px->g - g) +
1078 (px->b - b)*(px->b - b);
1079 if (px->mindist > dist)
1081 if (px->use > mindist) {
1088 pixarr_sorted[i] = pixarr[minpix];
1089 pixarr[minpix].use = 0;
1092 QXcbColormap cmap = QXcbColormap::instance(xinfo.screen());
1094 px = &pixarr_sorted[0];
1095 for (
int i = 0; i < ncols; i++) {
1096 QColor c(px->r, px->g, px->b);
1097 pix[px->index] = cmap.pixel(c);
1102 for (size_t i = 0; i < nbytes; i++) {
1109 xi = XCreateImage(dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0);
1110 if (xi->bits_per_pixel == 16) {
1112 int p2inc = xi->bytes_per_line/
sizeof(ushort);
1113 ushort *newerbits = (ushort *)malloc(xi->bytes_per_line * h);
1114 Q_CHECK_PTR(newerbits);
1118 for (
int y = 0; y < h; y++) {
1119 p2 = newerbits + p2inc*y;
1120 for (
int x = 0; x < w; x++)
1124 newbits = (uchar *)newerbits;
1125 }
else if (xi->bits_per_pixel != 8) {
1126 qWarning(
"QPixmap::fromImage: Display not supported "
1127 "(bpp=%d)", xi->bits_per_pixel);
1129 xi->data = (
char *)newbits;
1132 hd = XCreatePixmap(dpy,
1133 RootWindow(dpy, xinfo.screen()),
1136 GC gc = XCreateGC(dpy, hd, 0, 0);
1137 XPutImage(dpy, hd, gc, xi, 0, 0, 0, 0, w, h);
1143#if QT_CONFIG(xrender)
1144 if (X11->use_xrender) {
1145 XRenderPictFormat *format = d == 1
1146 ? XRenderFindStandardFormat(dpy, PictStandardA1)
1147 : XRenderFindVisualFormat(dpy, (Visual *)xinfo.visual());
1148 picture = XRenderCreatePicture(dpy, hd, format, 0, 0);
1153 QBitmap m = QBitmap::fromImage(image.createAlphaMask(flags));
1160 if (data->pixelType() == BitmapType) {
1161 fromImage(data->toImage().copy(rect), Qt::AutoColor);
1167 setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1));
1169 flags &= ~Uninitialized;
1170 xinfo = x11Data->xinfo;
1174 is_null = (w <= 0 || h <= 0);
1175 hd = XCreatePixmap(xinfo.display(),
1176 RootWindow(xinfo.display(), x11Data->xinfo.screen()),
1178#if QT_CONFIG(xrender)
1179 if (X11->use_xrender) {
1180 XRenderPictFormat *format = d == 32
1181 ? XRenderFindStandardFormat(xinfo.display(), PictStandardARGB32)
1182 : XRenderFindVisualFormat(xinfo.display(), (Visual *)xinfo.visual());
1183 picture = XRenderCreatePicture(xinfo.display(), hd, format, 0, 0);
1186 if (x11Data->x11_mask) {
1187 x11_mask = XCreatePixmap(xinfo.display(), hd, w, h, 1);
1188#if QT_CONFIG(xrender)
1189 if (X11->use_xrender) {
1190 mask_picture = XRenderCreatePicture(xinfo.display(), x11_mask,
1191 XRenderFindStandardFormat(xinfo.display(), PictStandardA1), 0, 0);
1192 XRenderPictureAttributes attrs;
1193 attrs.alpha_map = x11Data->mask_picture;
1194 XRenderChangePicture(xinfo.display(), x11Data->picture, CPAlphaMap, &attrs);
1199#if QT_CONFIG(xrender)
1200 if (x11Data->picture && x11Data->d == 32) {
1201 XRenderComposite(xinfo.display(), PictOpSrc,
1202 x11Data->picture, 0, picture,
1203 rect.x(), rect.y(), 0, 0, 0, 0, w, h);
1207 GC gc = XCreateGC(xinfo.display(), hd, 0, 0);
1208 XCopyArea(xinfo.display(), x11Data->hd, hd, gc,
1209 rect.x(), rect.y(), w, h, 0, 0);
1210 if (x11Data->x11_mask) {
1211 GC monogc = XCreateGC(xinfo.display(), x11_mask, 0, 0);
1212 XCopyArea(xinfo.display(), x11Data->x11_mask, x11_mask, monogc,
1213 rect.x(), rect.y(), w, h, 0, 0);
1214 XFreeGC(xinfo.display(), monogc);
1216 XFreeGC(xinfo.display(), gc);
1222 GC gc = XCreateGC(xinfo.display(), hd, 0, 0);
1223 XCopyArea(xinfo.display(), hd, hd, gc,
1224 rect.left(), rect.top(), rect.width(), rect.height(),
1225 rect.left() + dx, rect.top() + dy);
1226 XFreeGC(xinfo.display(), gc);
1233 case QPaintDevice::PdmDevicePixelRatio:
1234 return devicePixelRatio();
1236 case QPaintDevice::PdmDevicePixelRatioScaled:
1237 return devicePixelRatio() * QPaintDevice::devicePixelRatioFScale();
1239 case QPaintDevice::PdmWidth:
1241 case QPaintDevice::PdmHeight:
1243 case QPaintDevice::PdmNumColors:
1245 case QPaintDevice::PdmDepth:
1247 case QPaintDevice::PdmWidthMM: {
1248 const int screen = xinfo.screen();
1249 const int mm = DisplayWidthMM(xinfo.display(), screen) * w
1250 / DisplayWidth(xinfo.display(), screen);
1253 case QPaintDevice::PdmHeightMM: {
1254 const int screen = xinfo.screen();
1255 const int mm = (DisplayHeightMM(xinfo.display(), screen) * h)
1256 / DisplayHeight(xinfo.display(), screen);
1259 case QPaintDevice::PdmDpiX:
1260 case QPaintDevice::PdmPhysicalDpiX:
1261 return QXcbX11Info::appDpiX(xinfo.screen());
1262 case QPaintDevice::PdmDpiY:
1263 case QPaintDevice::PdmPhysicalDpiY:
1264 return QXcbX11Info::appDpiY(xinfo.screen());
1266 qWarning(
"QX11PlatformPixmap::metric(): Invalid metric");
1273 if (fillColor.alpha() != 255) {
1274#if QT_CONFIG(xrender)
1275 if (X11->use_xrender) {
1276 if (!picture || d != 32)
1277 convertToARGB32(
false);
1279 ::Picture src = X11->getSolidFill(xinfo.screen(), fillColor);
1280 XRenderComposite(xinfo.display(), PictOpSrc, src, 0, picture,
1281 0, 0, width(), height(),
1282 0, 0, width(), height());
1286 QImage im(width(), height(), QImage::Format_ARGB32_Premultiplied);
1287 im.fill(PREMUL(fillColor.rgba()));
1289 fromImage(im, Qt::AutoColor | Qt::OrderedAlphaDither);
1294 GC gc = XCreateGC(xinfo.display(), hd, 0, 0);
1296 XSetForeground(xinfo.display(), gc, qGray(fillColor.rgb()) > 127 ? 0 : 1);
1297 }
else if (
X11->use_xrender && d >= 24) {
1298 XSetForeground(xinfo.display(), gc, fillColor.rgba());
1300 XSetForeground(xinfo.display(), gc,
1301 QXcbColormap::instance(xinfo.screen()).pixel(fillColor));
1303 XFillRectangle(xinfo.display(), hd, gc, 0, 0, width(), height());
1304 XFreeGC(xinfo.display(), gc);
1310#if QT_CONFIG(xrender)
1311 if (picture && d == 32) {
1313 mask = QBitmap::fromImage(toImage().createAlphaMask());
1318 mask = QBitmap::fromPixmap(QPixmap(that));
1320 mask = mask_to_bitmap(xinfo.screen());
1327 if (newmask.isNull()) {
1328#if QT_CONFIG(xrender)
1329 if (picture && d == 32) {
1330 QX11PlatformPixmap newData(pixelType());
1331 newData.resize(w, h);
1332 newData.fill(Qt::black);
1333 XRenderComposite(xinfo.display(), PictOpOver,
1334 picture, 0, newData.picture,
1335 0, 0, 0, 0, 0, 0, w, h);
1345 newData.x11_mask = 0;
1346 newData.picture = 0;
1347 newData.mask_picture = 0;
1352#if QT_CONFIG(xrender)
1354 XRenderPictureAttributes attrs;
1355 attrs.alpha_map = 0;
1356 XRenderChangePicture(xinfo.display(), picture, CPAlphaMap,
1360 XRenderFreePicture(xinfo.display(), mask_picture);
1363 XFreePixmap(xinfo.display(), x11_mask);
1369#if QT_CONFIG(xrender)
1370 if (picture && d == 32) {
1371 XRenderComposite(xinfo.display(), PictOpSrc,
1372 picture, qt_x11Pixmap(newmask)->x11PictureHandle(),
1373 picture, 0, 0, 0, 0, 0, 0, w, h);
1378 vals.function = GXand;
1379 GC gc = XCreateGC(xinfo.display(), hd, GCFunction, &vals);
1380 XCopyArea(xinfo.display(), qt_x11Pixmap(newmask)->handle(), hd, gc, 0, 0,
1381 width(), height(), 0, 0);
1382 XFreeGC(xinfo.display(), gc);
1386 XFreePixmap(xinfo.display(), x11_mask);
1387#if QT_CONFIG(xrender)
1389 XRenderFreePicture(xinfo.display(), mask_picture);
1392 x11_mask = QX11PlatformPixmap::bitmap_to_mask(newmask, xinfo.screen());
1393#if QT_CONFIG(xrender)
1395 mask_picture = XRenderCreatePicture(xinfo.display(), x11_mask,
1396 XRenderFindStandardFormat(xinfo.display(), PictStandardA1), 0, 0);
1397 XRenderPictureAttributes attrs;
1398 attrs.alpha_map = mask_picture;
1399 XRenderChangePicture(xinfo.display(), picture, CPAlphaMap, &attrs);
1407 if (picture && d == 32)
1410 if (x11_mask && d == 1)
1418 if (mode == Qt::SmoothTransformation || transform.type() >= QTransform::TxProject) {
1419 QImage image = toImage();
1420 return QPixmap::fromImage(image.transformed(transform, mode));
1431 bool depth1 = depth() == 1;
1432 Display *dpy = xinfo.display();
1437 QTransform mat(transform.m11(), transform.m12(), transform.m13(),
1438 transform.m21(), transform.m22(), transform.m23(),
1440 bool complex_xform =
false;
1442 if (mat.type() <= QTransform::TxScale) {
1443 h = qRound(qAbs(mat.m22()) * hs);
1444 w = qRound(qAbs(mat.m11()) * ws);
1446 QPolygonF a(QRectF(0, 0, ws, hs));
1448 QRect r = a.boundingRect().toAlignedRect();
1451 complex_xform =
true;
1453 mat = QPixmap::trueMatrix(mat, ws, hs);
1456 mat = mat.inverted(&invertible);
1458 if (h == 0 || w == 0 || !invertible
1459 || qAbs(h) >= 32768 || qAbs(w) >= 32768 )
1463 XImage *xi = XGetImage(xinfo.display(), handle(), 0, 0, ws, hs, AllPlanes,
1464 depth1 ? XYPixmap : ZPixmap);
1469 sbpl = xi->bytes_per_line;
1470 sptr = (uchar *)xi->data;
1471 bpp = xi->bits_per_pixel;
1476 dbpl = ((w*bpp+31)/32)*4;
1479 dptr = (uchar *)malloc(dbytes);
1482 memset(dptr, 0, dbytes);
1484 memset(dptr, WhitePixel(xinfo.display(), xinfo.screen()), dbytes);
1486 memset(dptr, 0, dbytes);
1489#if defined(QT_DEBUG_XIMAGE)
1490 qDebug(
"----IMAGE--INFO--------------");
1491 qDebug(
"width............. %d", xi->width);
1492 qDebug(
"height............ %d", xi->height);
1493 qDebug(
"xoffset........... %d", xi->xoffset);
1494 qDebug(
"format............ %d", xi->format);
1495 qDebug(
"byte order........ %d", xi->byte_order);
1496 qDebug(
"bitmap unit....... %d", xi->bitmap_unit);
1497 qDebug(
"bitmap bit order.. %d", xi->bitmap_bit_order);
1498 qDebug(
"depth............. %d", xi->depth);
1499 qDebug(
"bytes per line.... %d", xi->bytes_per_line);
1500 qDebug(
"bits per pixel.... %d", xi->bits_per_pixel);
1504 if (xi->bitmap_bit_order == MSBFirst)
1505 type = QT_XFORM_TYPE_MSBFIRST;
1507 type = QT_XFORM_TYPE_LSBFIRST;
1511 p_inc = dbpl - xbpl;
1514 p_inc = dbpl - xbpl;
1517 if (!qt_xForm_helper(mat, xi->xoffset, type, bpp, dptr, xbpl, p_inc, h, sptr, sbpl, ws, hs)){
1518 qWarning(
"QPixmap::transform: display not supported (bpp=%d)",bpp);
1527 QBitmap bm = QBitmap::fromData(QSize(w, h), dptr,
1528 BitmapBitOrder(xinfo.display()) == MSBFirst
1529 ? QImage::Format_Mono
1530 : QImage::Format_MonoLSB);
1535 QPixmap pm(x11Data);
1537 x11Data->xinfo = xinfo;
1541 x11Data->is_null = (w <= 0 || h <= 0);
1542 x11Data->hd = XCreatePixmap(xinfo.display(),
1543 RootWindow(xinfo.display(), xinfo.screen()),
1545 x11Data->setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1));
1547#if QT_CONFIG(xrender)
1548 if (X11->use_xrender) {
1549 XRenderPictFormat *format = x11Data->d == 32
1550 ? XRenderFindStandardFormat(xinfo.display(), PictStandardARGB32)
1551 : XRenderFindVisualFormat(xinfo.display(), (Visual *) x11Data->xinfo.visual());
1552 x11Data->picture = XRenderCreatePicture(xinfo.display(), x11Data->hd, format, 0, 0);
1556 GC gc = XCreateGC(xinfo.display(), x11Data->hd, 0, 0);
1557 xi = XCreateImage(dpy, (Visual*)x11Data->xinfo.visual(),
1559 ZPixmap, 0, (
char *)dptr, w, h, 32, 0);
1560 XPutImage(dpy, qt_x11Pixmap(pm)->handle(), gc, xi, 0, 0, 0, 0, w, h);
1562 XFreeGC(xinfo.display(), gc);
1565 pm.setMask(mask_to_bitmap(xinfo.screen()).transformed(transform));
1566 }
else if (d != 32 && complex_xform) {
1567 QBitmap mask(ws, hs);
1568 mask.fill(Qt::color1);
1569 pm.setMask(mask.transformed(transform));
1577 return toImage(QRect(0, 0, w, h));
1585 unsigned int width_return;
1586 unsigned int height_return;
1587 unsigned int border_width_return;
1588 unsigned int depth_return;
1590 XGetGeometry(xinfo.display(), hd, &root_return, &x_return, &y_return, &width_return, &height_return, &border_width_return, &depth_return);
1593 xiWrapper.xi = XGetImage(xinfo.display(), hd, rect.x(), rect.y(), rect.width(), rect.height(),
1594 AllPlanes, (depth() == 1) ? XYPixmap : ZPixmap);
1596 Q_CHECK_PTR(xiWrapper
.xi);
1600 if (!x11_mask && canTakeQImageFromXImage(xiWrapper))
1601 return takeQImageFromXImage(xiWrapper);
1603 QImage image = toImage(xiWrapper, rect);
1608#if QT_CONFIG(xrender)
1609static XRenderPictFormat *qt_renderformat_for_depth(
const QXcbX11Info &xinfo,
int depth)
1612 return XRenderFindStandardFormat(xinfo.display(), PictStandardA1);
1613 else if (depth == 32)
1614 return XRenderFindStandardFormat(xinfo.display(), PictStandardARGB32);
1616 return XRenderFindVisualFormat(xinfo.display(), (Visual *)xinfo.visual());
1620Q_GLOBAL_STATIC(QX11PaintEngine, qt_x11_paintengine)
1622QPaintEngine *QX11PlatformPixmap::paintEngine()
const
1624 QX11PlatformPixmap *that =
const_cast<QX11PlatformPixmap*>(
this);
1626 if ((flags & Readonly)) {
1629 ::Pixmap hd_copy = XCreatePixmap(xinfo.display(), RootWindow(xinfo.display(), xinfo.screen()),
1631#if QT_CONFIG(xrender)
1632 if (picture && d == 32) {
1633 XRenderPictFormat *format = qt_renderformat_for_depth(xinfo, d);
1634 ::Picture picture_copy = XRenderCreatePicture(xinfo.display(),
1638 XRenderComposite(xinfo.display(), PictOpSrc, picture, 0, picture_copy,
1639 0, 0, 0, 0, 0, 0, w, h);
1640 XRenderFreePicture(xinfo.display(), picture);
1641 that->picture = picture_copy;
1645 GC gc = XCreateGC(xinfo.display(), hd_copy, 0, 0);
1646 XCopyArea(xinfo.display(), hd, hd_copy, gc, 0, 0, w, h, 0, 0);
1647 XFreeGC(xinfo.display(), gc);
1650 that->flags &= ~QX11PlatformPixmap::Readonly;
1653 if (qt_x11_paintengine->isActive()) {
1655 that->pengine =
new QX11PaintEngine;
1657 return that->pengine;
1660 return qt_x11_paintengine();
1663qreal QX11PlatformPixmap::devicePixelRatio()
const
1668void QX11PlatformPixmap::setDevicePixelRatio(qreal scaleFactor)
1673Pixmap QX11PlatformPixmap::x11ConvertToDefaultDepth()
1675#if QT_CONFIG(xrender)
1676 if (d == xinfo.appDepth() || !X11->use_xrender)
1679 hd2 = XCreatePixmap(xinfo.display(), hd, w, h, xinfo.appDepth());
1680 XRenderPictFormat *format = XRenderFindVisualFormat(xinfo.display(),
1681 (Visual*) xinfo.visual());
1682 Picture pic = XRenderCreatePicture(xinfo.display(), hd2, format, 0, 0);
1683 XRenderComposite(xinfo.display(), PictOpSrc, picture,
1684 XNone, pic, 0, 0, 0, 0, 0, 0, w, h);
1685 XRenderFreePicture(xinfo.display(), pic);
1693XID QX11PlatformPixmap::createBitmapFromImage(
const QImage &image)
1695 QImage img = image.convertToFormat(QImage::Format_MonoLSB);
1696 const QRgb c0 = QColor(Qt::black).rgb();
1697 const QRgb c1 = QColor(Qt::white).rgb();
1698 if (img.color(0) == c0 && img.color(1) == c1) {
1700 img.setColor(0, c1);
1701 img.setColor(1, c0);
1706 int w = img.width();
1707 int h = img.height();
1708 int bpl = (w + 7) / 8;
1709 qsizetype ibpl = img.bytesPerLine();
1711 tmp_bits =
new uchar[bpl*h];
1712 bits = (
char *)tmp_bits;
1716 p = img.scanLine(0);
1717 for (y = 0; y < h; y++) {
1723 bits = (
char *)img.bits();
1726 XID hd = XCreateBitmapFromData(QXcbX11Info::display(),
1727 QXcbX11Info::appRootWindow(),
1734bool QX11PlatformPixmap::isBackingStore()
const
1736 return (flags & IsBackingStore);
1739void QX11PlatformPixmap::setIsBackingStore(
bool on)
1742 flags |= IsBackingStore;
1744 flags &= ~IsBackingStore;
1748#if QT_CONFIG(xrender)
1749void QX11PlatformPixmap::convertToARGB32(
bool preserveContents)
1751 if (!X11->use_xrender)
1755 if ((flags & Readonly))
1758 Pixmap pm = XCreatePixmap(xinfo.display(), RootWindow(xinfo.display(), xinfo.screen()),
1760 Picture p = XRenderCreatePicture(xinfo.display(), pm,
1761 XRenderFindStandardFormat(xinfo.display(), PictStandardARGB32), 0, 0);
1763 if (preserveContents)
1764 XRenderComposite(xinfo.display(), PictOpSrc, picture, 0, p, 0, 0, 0, 0, 0, 0, w, h);
1765 if (!(flags & Readonly))
1766 XRenderFreePicture(xinfo.display(), picture);
1768 if (hd && !(flags & Readonly))
1769 XFreePixmap(xinfo.display(), hd);
1771 XFreePixmap(xinfo.display(), x11_mask);
1773 XRenderFreePicture(xinfo.display(), mask_picture);
1783 XVisualInfo visinfo;
1784 if (XMatchVisualInfo(xinfo.display(), xinfo.screen(), 32, TrueColor, &visinfo))
1785 xinfo.setVisual(visinfo.visual);
1789void QX11PlatformPixmap::release()
1794 if ( QCoreApplication::closingDown()) {
1801#if QT_CONFIG(xrender)
1803 XRenderFreePicture(xinfo.display(), mask_picture);
1806 XFreePixmap(xinfo.display(), x11_mask);
1811#if QT_CONFIG(xrender)
1813 XRenderFreePicture(xinfo.display(), picture);
1819 XFreePixmap(xinfo.display(), hd2);
1822 if (!(flags & Readonly))
1823 XFreePixmap(xinfo.display(), hd);
1828QImage QX11PlatformPixmap::toImage(
const QXImageWrapper &xiWrapper,
const QRect &rect)
const
1830 XImage *xi = xiWrapper.xi;
1833 Visual *visual = (Visual *)xinfo.visual();
1834 bool trucol = (visual->c_class >= TrueColor) && d > 1;
1836 QImage::Format format = QImage::Format_Mono;
1837 if (d > 1 && d <= 8) {
1839 format = QImage::Format_Indexed8;
1844 if (d > 8 || trucol) {
1846 format = QImage::Format_RGB32;
1849 if (d == 1 && xi->bitmap_bit_order == LSBFirst)
1850 format = QImage::Format_MonoLSB;
1851 if (x11_mask && format == QImage::Format_RGB32)
1852 format = QImage::Format_ARGB32;
1854 QImage image(xi->width, xi->height, format);
1855 image.setDevicePixelRatio(devicePixelRatio());
1861 if (rect.contains(QRect(0, 0, w, h)))
1862 alpha = mask().toImage();
1864 alpha = mask().toImage().copy(rect);
1866 bool ale = alpha.format() == QImage::Format_MonoLSB;
1869 const uint red_mask = (uint)visual->red_mask;
1870 const uint green_mask = (uint)visual->green_mask;
1871 const uint blue_mask = (uint)visual->blue_mask;
1872 const int red_shift = highest_bit(red_mask) - 7;
1873 const int green_shift = highest_bit(green_mask) - 7;
1874 const int blue_shift = highest_bit(blue_mask) - 7;
1876 const uint red_bits = n_bits(red_mask);
1877 const uint green_bits = n_bits(green_mask);
1878 const uint blue_bits = n_bits(blue_mask);
1880 static uint red_table_bits = 0;
1881 static uint green_table_bits = 0;
1882 static uint blue_table_bits = 0;
1884 if (red_bits < 8 && red_table_bits != red_bits) {
1885 build_scale_table(&red_scale_table, red_bits);
1886 red_table_bits = red_bits;
1888 if (blue_bits < 8 && blue_table_bits != blue_bits) {
1889 build_scale_table(&blue_scale_table, blue_bits);
1890 blue_table_bits = blue_bits;
1892 if (green_bits < 8 && green_table_bits != green_bits) {
1893 build_scale_table(&green_scale_table, green_bits);
1894 green_table_bits = green_bits;
1902 int bppc = xi->bits_per_pixel;
1904 if (bppc > 8 && xi->byte_order == LSBFirst)
1907 for (
int y = 0; y < xi->height; ++y) {
1908 uchar* asrc = x11_mask ? alpha.scanLine(y) : 0;
1909 dst = (QRgb *)image.scanLine(y);
1910 src = (uchar *)xi->data + xi->bytes_per_line*y;
1911 for (
int x = 0; x < xi->width; x++) {
1917 pixel = src[1] | (uint)src[0] << 8;
1921 pixel = src[0] | (uint)src[1] << 8;
1925 pixel = src[2] | (uint)src[1] << 8 | (uint)src[0] << 16;
1929 pixel = src[0] | (uint)src[1] << 8 | (uint)src[2] << 16;
1933 pixel = src[3] | (uint)src[2] << 8 | (uint)src[1] << 16 | (uint)src[0] << 24;
1937 pixel = src[0] | (uint)src[1] << 8 | (uint)src[2] << 16 | (uint)src[3] << 24;
1944 qWarning(
"QPixmap::convertToImage: Invalid depth %d", bppc);
1947 r = (pixel & red_mask) >> red_shift;
1949 r = (pixel & red_mask) << -red_shift;
1950 if (green_shift > 0)
1951 g = (pixel & green_mask) >> green_shift;
1953 g = (pixel & green_mask) << -green_shift;
1955 b = (pixel & blue_mask) >> blue_shift;
1957 b = (pixel & blue_mask) << -blue_shift;
1960 r = red_scale_table[r];
1962 g = green_scale_table[g];
1964 b = blue_scale_table[b];
1968 *dst++ = (asrc[x >> 3] & (1 << (x & 7))) ? qRgba(r, g, b, 0xff) : 0;
1970 *dst++ = (asrc[x >> 3] & (0x80 >> (x & 7))) ? qRgba(r, g, b, 0xff) : 0;
1973 *dst++ = qRgb(r, g, b);
1977 }
else if (xi->bits_per_pixel == d) {
1978 char *xidata = xi->data;
1979 qsizetype bpl = qMin(image.bytesPerLine(),xi->bytes_per_line);
1980 for (
int y=0; y<xi->height; y++) {
1981 memcpy(image.scanLine(y), xidata, bpl);
1982 xidata += xi->bytes_per_line;
1986 qWarning(
"QPixmap::convertToImage: Display not supported (bpp=%d)",
1987 xi->bits_per_pixel);
1992 image.setColorCount(2);
1993 image.setColor(0, qRgb(255,255,255));
1994 image.setColor(1, qRgb(0,0,0));
1995 }
else if (!trucol) {
2001 memset(use, 0, 256);
2002 memset(pix, 0, 256);
2003 qsizetype bpl = image.bytesPerLine();
2006 for (
int i = 0; i < xi->height; i++) {
2007 uchar* asrc = alpha.scanLine(i);
2008 p = image.scanLine(i);
2010 for (
int x = 0; x < xi->width; x++) {
2011 if (asrc[x >> 3] & (1 << (x & 7)))
2016 for (
int x = 0; x < xi->width; x++) {
2017 if (asrc[x >> 3] & (0x80 >> (x & 7)))
2024 for (
int i = 0; i < xi->height; i++) {
2025 p = image.scanLine(i);
2032 for (
int i = 0; i < 256; i++) {
2036 for (
int i = 0; i < xi->height; i++) {
2037 p = image.scanLine(i);
2048 image.setColorCount(ncols);
2049 image.setColor(trans, 0x00000000);
2051 image.setColorCount(ncols);
2054 trans = image.scanLine(0)[0];
2056 for (
int i = 0; i < xi->height; i++) {
2057 uchar* asrc = alpha.scanLine(i);
2058 p = image.scanLine(i);
2060 for (
int x = 0; x < xi->width; x++) {
2061 if (!(asrc[x >> 3] & (1 << (x & 7))))
2066 for (
int x = 0; x < xi->width; x++) {
2067 if (!(asrc[x >> 3] & (1 << (7 -(x & 7)))))
2074 image.setColorCount(ncols);
2076 QList<QColor> colors = QXcbColormap::instance(xinfo.screen()).colormap();
2078 for (
int i=0; i<colors.size(); i++) {
2080 image.setColor(j++, 0xff000000 | colors.at(i).rgb());
static QXcbX11Info fromScreen(int screen)
friend void qt_x11SetScreen(QPixmap &pixmap, int screen)
static Display * display()
QPixmap qt_toX11Pixmap(const QPixmap &pixmap)
QDebug Q_GUI_EXPORT & operator<<(QDebug &s, const QVectorPath &path)
static uint * blue_scale_table
static uint * red_scale_table
#define GET_PIXEL_DITHER_TC
#define GET_PIXEL_DITHER_TC_OPT(red_shift, green_shift, blue_shift, red_mask, green_mask, blue_mask, rbits, gbits, bbits)
static void build_scale_table(uint **table, uint nBits)
static uint n_bits(uint v)
Drawable qt_x11Handle(const QPixmap &pixmap)
QBasicAtomicInt qt_pixmap_serial
static int highest_bit(uint v)
QPixmap qt_toX11Pixmap(const QImage &image)
static void cleanup_scale_tables()
static void qSafeXDestroyImage(XImage *x)
static uint * green_scale_table
int qt_x11SetDefaultScreen(int screen)
QX11AlphaDetector(const QImage *i, Qt::ImageConversionFlags flags)
bool hasXRenderAndAlpha() const