src/plugins/imageformats/gif/qgifhandler.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   333                     sheight = newtop + newheight;
   333                     sheight = newtop + newheight;
   334 
   334 
   335                 QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32;
   335                 QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32;
   336                 if (image->isNull()) {
   336                 if (image->isNull()) {
   337                     (*image) = QImage(swidth, sheight, format);
   337                     (*image) = QImage(swidth, sheight, format);
   338                     memset(image->bits(), 0, image->numBytes());
   338                     memset(image->bits(), 0, image->byteCount());
   339 
   339 
   340                     // ### size of the upcoming frame, should rather
   340                     // ### size of the upcoming frame, should rather
   341                     // be known before decoding it.
   341                     // be known before decoding it.
   342                     *nextSize = QSize(swidth, sheight);
   342                     *nextSize = QSize(swidth, sheight);
   343                 }
   343                 }
   391                         || backingstore.height() < h) {
   391                         || backingstore.height() < h) {
   392                         // We just use the backing store as a byte array
   392                         // We just use the backing store as a byte array
   393                         backingstore = QImage(qMax(backingstore.width(), w),
   393                         backingstore = QImage(qMax(backingstore.width(), w),
   394                                               qMax(backingstore.height(), h),
   394                                               qMax(backingstore.height(), h),
   395                                               QImage::Format_RGB32);
   395                                               QImage::Format_RGB32);
   396                         memset(image->bits(), 0, image->numBytes());
   396                         memset(image->bits(), 0, image->byteCount());
   397                     }
   397                     }
   398                     for (int ln=0; ln<h; ln++) {
   398                     for (int ln=0; ln<h; ln++) {
   399                         memcpy(backingstore.scanLine(ln),
   399                         memcpy(backingstore.scanLine(ln),
   400                                image->scanLine(t+ln)+l, w*sizeof(QRgb));
   400                                image->scanLine(t+ln)+l, w*sizeof(QRgb));
   401                     }
   401                     }