250 , m_hasFillColor(false) |
250 , m_hasFillColor(false) |
251 , m_hasAlpha(false) |
251 , m_hasAlpha(false) |
252 { |
252 { |
253 setSerialNumber(++qt_gl_pixmap_serial); |
253 setSerialNumber(++qt_gl_pixmap_serial); |
254 m_glDevice.setPixmapData(this); |
254 m_glDevice.setPixmapData(this); |
255 |
|
256 // Set InteralBindOptions minus the memory managed, since this |
|
257 // QGLTexture is not managed as part of the internal texture cache |
|
258 m_texture.options = QGLContext::PremultipliedAlphaBindOption; |
|
259 } |
255 } |
260 |
256 |
261 QGLPixmapData::~QGLPixmapData() |
257 QGLPixmapData::~QGLPixmapData() |
262 { |
258 { |
263 QGLWidget *shareWidget = qt_gl_share_widget(); |
259 QGLWidget *shareWidget = qt_gl_share_widget(); |
342 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
338 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
343 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
339 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
344 } |
340 } |
345 |
341 |
346 if (!m_source.isNull()) { |
342 if (!m_source.isNull()) { |
347 glBindTexture(target, m_texture.id); |
|
348 if (external_format == GL_RGB) { |
343 if (external_format == GL_RGB) { |
349 const QImage tx = m_source.convertToFormat(QImage::Format_RGB888); |
344 const QImage tx = m_source.convertToFormat(QImage::Format_RGB888).mirrored(false, true); |
|
345 |
|
346 glBindTexture(target, m_texture.id); |
350 glTexSubImage2D(target, 0, 0, 0, w, h, external_format, |
347 glTexSubImage2D(target, 0, 0, 0, w, h, external_format, |
351 GL_UNSIGNED_BYTE, tx.bits()); |
348 GL_UNSIGNED_BYTE, tx.bits()); |
352 } else { |
349 } else { |
353 const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, external_format); |
350 const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, external_format); |
|
351 |
|
352 glBindTexture(target, m_texture.id); |
354 glTexSubImage2D(target, 0, 0, 0, w, h, external_format, |
353 glTexSubImage2D(target, 0, 0, 0, w, h, external_format, |
355 GL_UNSIGNED_BYTE, tx.bits()); |
354 GL_UNSIGNED_BYTE, tx.bits()); |
356 // convertToGLFormat will flip the Y axis, so it needs to |
|
357 // be drawn upside down |
|
358 m_texture.options |= QGLContext::InvertedYBindOption; |
|
359 } |
355 } |
360 |
356 |
361 if (useFramebufferObjects()) |
357 if (useFramebufferObjects()) |
362 m_source = QImage(); |
358 m_source = QImage(); |
363 } |
359 } |