Attempt to work around Qt 4.8 bug in fromX11Pixmap when masks are converted

r14.0.x
Timothy Pearson 12 years ago
parent 7d8cc6ed5b
commit 4f0b6320a7

@ -31,6 +31,11 @@
#include "tdeqt4converter.h"
#define SET_BIT(x, y) (x |= 1 << y)
#define TEST_BIT(x, y) ((x & (1 << y)) >> y)
// #define USE_FROMX11_PIXMAP
/*!
\class TDEQt4PaintDevice tdeqt4painter.h
\brief The TDEQt4PaintDevice class is a paint device that translates
@ -121,6 +126,7 @@ bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
// SLOW
TQRect tqt3br = p[0].rgn->boundingRect();
if (!tqt3br.isNull()) {
#ifdef USE_FROMX11_PIXMAP
TQBitmap regionMask(tqt3br.x()+tqt3br.width(), tqt3br.y()+tqt3br.height());
regionMask.fill(TQt::color0);
TQPainter tqt3brpainter(&regionMask);
@ -128,6 +134,32 @@ bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
tqt3brpainter.fillRect(0,0,regionMask.width(),regionMask.height(),TQt::color1);
tqt3brpainter.end();
QBitmap qt4RegionMask = QPixmap::fromX11Pixmap(regionMask.handle(), QPixmap::ImplicitlyShared);
#else // USE_FROMX11_PIXMAP
TQBitmap regionMask(tqt3br.x()+tqt3br.width(), tqt3br.y()+tqt3br.height(), 32);
int width = regionMask.width();
int height = regionMask.height();
int size = (((width*height)/8)+1);
unsigned char* monoData = (unsigned char*)malloc(size);
memset(monoData, 0, size);
int x;
int y;
int byte = 0;
int bit = 7;
for (x=0; x<width; x++) {
for (y=0; y<height; y++) {
if (p[0].rgn->contains(TQPoint(x,y))) {
SET_BIT(monoData[byte], bit);
}
bit--;
if (bit < 0) {
bit = 7;
byte++;
}
}
}
QBitmap qt4RegionMask = QBitmap::fromData(QSize(width, height), monoData, QImage::Format_Mono);
free(monoData);
#endif // USE_FROMX11_PIXMAP
qt4region = QRegion(qt4RegionMask);
#endif
TQPainter::CoordinateMode tqt3coordmode = (TQPainter::CoordinateMode)p[1].ival;

@ -242,7 +242,8 @@ Qt4TDEStyle::Qt4TDEStyle() : m_aboutData(NULL), m_tqApplication(NULL), m_tdeAppl
#if QT_VERSION > 0x040800
// How a bug of this magnitude could go undetected in a major Qt4 release is beyond me...I guess cell phones don't generally use thin lines in their widgets!?
// This is Yet Another Example of why TDE cannot rely on Qt4 for anything of any real importance
printf("[WARNING] Qt4 >= Qt 4.8.0 detected; you are likely affected by these Qt4 bugs:\n\r[WARNING] https://bugreports.qt-project.org/browse/QTBUG-25896\n\r[WARNING] https://bugreports.qt-project.org/browse/QTBUG-26013\n\r[WARNING] There is no known workaround for this problem; your Qt4 application will display with numerous graphical glitches.\n\r"); fflush(stdout);
printf("[WARNING] Qt4 >= Qt 4.8.0 detected; you are likely affected by these Qt4 bugs:\n\r[WARNING] https://bugreports.qt-project.org/browse/QTBUG-25896\n\r[WARNING] https://bugreports.qt-project.org/browse/QTBUG-26013\n\r[WARNING] There is no known workaround for this problem; your Qt4 application will display with numerous graphical glitches.\n\r");
printf("[WARNING] You are also likely affected by a bug in QPixmap::fromX11Pixmap, which will result\n\r[WARNING] in qtoctave and similar applications failing to display, along with numerous BadDrawable errors!\n\r"); fflush(stdout);
#endif
}

Loading…
Cancel
Save