summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Dominic K <mdk@codethink.co.uk>2010-11-02 10:35:42 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-11-02 10:35:42 (GMT)
commit2f12d81a72fe6abb48cce4d327ecc27d308a8418 (patch)
tree8beba36a286afcab6e16d3739acdcefdf20a6c0e
parenta1aee0f169614b31a7fde201a3d1c64010198218 (diff)
downloadQt-2f12d81a72fe6abb48cce4d327ecc27d308a8418.zip
Qt-2f12d81a72fe6abb48cce4d327ecc27d308a8418.tar.gz
Qt-2f12d81a72fe6abb48cce4d327ecc27d308a8418.tar.bz2
Use 32bit textures for alpha textures after all.
4444 16bit are too bad quality-wise. Merge-request: 2499 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
-rw-r--r--src/plugins/graphicssystems/meego/dithering.cpp18
-rw-r--r--src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp5
2 files changed, 21 insertions, 2 deletions
diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp
index 76d15a3..122c51e 100644
--- a/src/plugins/graphicssystems/meego/dithering.cpp
+++ b/src/plugins/graphicssystems/meego/dithering.cpp
@@ -286,3 +286,21 @@ unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, in
return out;
}
+
+unsigned char* convertBGRA32_to_RGBA32(const unsigned char *in, int width, int height, int stride)
+{
+ unsigned char *out = (unsigned char *) malloc(stride * height);
+
+ // For each line...
+ for (int y = 0; y < height; y++) {
+ // For each column
+ for (int x = 0; x < width; x++) {
+ out[(stride * y) + (x * 4) + 0] = in[(stride * y) + (x * 4) + 2];
+ out[(stride * y) + (x * 4) + 1] = in[(stride * y) + (x * 4) + 1];
+ out[(stride * y) + (x * 4) + 2] = in[(stride * y) + (x * 4) + 0];
+ out[(stride * y) + (x * 4) + 3] = in[(stride * y) + (x * 4) + 3];
+ }
+ }
+
+ return out;
+} \ No newline at end of file
diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
index 02a4273..eb63692 100644
--- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
@@ -51,6 +51,7 @@
// from dithering.cpp
extern unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride);
extern unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride);
+extern unsigned char* convertBGRA32_to_RGBA32(const unsigned char *in, int width, int height, int stride);
static EGLint preserved_image_attribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE };
@@ -146,8 +147,8 @@ Qt::HANDLE QMeeGoPixmapData::imageToEGLSharedImage(const QImage &image)
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
if (image.hasAlphaChannel() && const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels()) {
- void *converted = convertARGB32_to_RGBA4444(image.bits(), image.width(), image.height(), image.bytesPerLine());
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, converted);
+ void *converted = convertBGRA32_to_RGBA32(image.bits(), image.width(), image.height(), image.bytesPerLine());
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, converted);
free(converted);
} else {
void *converted = convertRGB32_to_RGB565(image.bits(), image.width(), image.height(), image.bytesPerLine());