From 1af2d09523e3808e4589f05a4b8d42c308eb0841 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 13 Oct 2010 11:38:39 +0200 Subject: Proper dither & proper alpha checking. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 854 Reviewed-by: Samuel Rødal --- src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp index 799a28e..5473d09 100644 --- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp +++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp @@ -169,7 +169,7 @@ void QMeeGoPixmapData::fromEGLSharedImage(Qt::HANDLE handle, const QImage &si) if (textureIsBound) { fromTexture(newTextureId, newWidth, newHeight, - si.hasAlphaChannel()); + (si.hasAlphaChannel() && const_cast(si).data_ptr()->checkForAlphaPixels())); texture()->options &= ~QGLContext::InvertedYBindOption; softImage = si; QMeeGoPixmapData::registerSharedImage(handle, softImage); @@ -191,12 +191,12 @@ Qt::HANDLE QMeeGoPixmapData::imageToEGLSharedImage(const QImage &image) glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); - if (image.hasAlphaChannel()) { - QImage convertedImage = image.convertToFormat(QImage::Format_ARGB4444_Premultiplied, Qt::NoOpaqueDetection); + if (image.hasAlphaChannel() && (image.hasAlphaChannel() && const_cast(image).data_ptr()->checkForAlphaPixels())) { + QImage convertedImage = image.convertToFormat(QImage::Format_ARGB4444_Premultiplied, Qt::DiffuseAlphaDither | Qt::DiffuseDither | Qt::PreferDither); qARGBA4ToRGBA4(&convertedImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, convertedImage.bits()); } else { - QImage convertedImage = image.convertToFormat(QImage::Format_RGB16, Qt::NoOpaqueDetection); + QImage convertedImage = image.convertToFormat(QImage::Format_RGB16, Qt::DiffuseAlphaDither | Qt::DiffuseDither | Qt::PreferDither); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, convertedImage.bits()); } -- cgit v0.12