Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.5.3
-
None
-
6f17a21647fe50ea79dd902220c1887b893f25b3
Description
The problem is related to copying and pasting image data on a windows system with the system display properties set to 16 bit color. The problem can be reproduced by building the charactermap example with a modified mainwindow.cpp, running the example on a system with 16 bit color, clicking on the To Clipboard button and pasting the image into an other non Qt application. The modified file is attached.
The problem code can be found in qbmphandler.cpp, qt_write_dib(). This method does not properly handle 16 bit color image data. The code snipet below show the issue.
for (y=image.height()-1; y>=0; y--) { // write the image bits if (nbits == 4) { // convert 8 -> 4 bits p = image.scanLine(y); b = buf; end = b + image.width()/2; while (b < end) { *b++ = (*p << 4) | (*(p+1) & 0x0f); p += 2; } if (image.width() & 1) *b = *p << 4; } else { // 32 bits QRgb *p = (QRgb *)image.scanLine(y); QRgb *end = p + image.width(); b = buf; while (p < end) { *b++ = qBlue(*p); *b++ = qGreen(*p); *b++ = qRed(*p); p++; } }