Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-4687

Qt crash when pasting image data on system with 16bit color

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 4.7.0
    • 4.5.3
    • Image formats
    • None
    • 6f17a21647fe50ea79dd902220c1887b893f25b3

      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++;
      }
      } 
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            vgt Eirik Aavitsland
            mpejcoch Martin Pejcoch (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes