src/opengl/qpixmapdata_gl.cpp
changeset 37 758a864f9613
parent 18 2f34d5167611
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
   365 
   365 
   366     m_texture.options &= ~QGLContext::MemoryManagedBindOption;
   366     m_texture.options &= ~QGLContext::MemoryManagedBindOption;
   367 }
   367 }
   368 
   368 
   369 void QGLPixmapData::fromImage(const QImage &image,
   369 void QGLPixmapData::fromImage(const QImage &image,
   370                               Qt::ImageConversionFlags /*flags*/)
   370                               Qt::ImageConversionFlags flags)
   371 {
   371 {
   372     if (image.size() == QSize(w, h))
   372     if (image.size() == QSize(w, h))
   373         setSerialNumber(++qt_gl_pixmap_serial);
   373         setSerialNumber(++qt_gl_pixmap_serial);
   374     resize(image.width(), image.height());
   374     resize(image.width(), image.height());
   375 
   375 
   379     } else {
   379     } else {
   380         QImage::Format format = QImage::Format_RGB32;
   380         QImage::Format format = QImage::Format_RGB32;
   381         if (qApp->desktop()->depth() == 16)
   381         if (qApp->desktop()->depth() == 16)
   382             format = QImage::Format_RGB16;
   382             format = QImage::Format_RGB16;
   383 
   383 
   384         if (image.hasAlphaChannel() && const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels())
   384         if (image.hasAlphaChannel()
       
   385             && ((flags & Qt::NoOpaqueDetection)
       
   386                 || const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels()))
   385             format = QImage::Format_ARGB32_Premultiplied;;
   387             format = QImage::Format_ARGB32_Premultiplied;;
   386 
   388 
   387         m_source = image.convertToFormat(format);
   389         m_source = image.convertToFormat(format);
   388     }
   390     }
   389 
   391