From 7e68fc7c44997414979784bb8281985c08488e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Fri, 12 Mar 2010 15:17:01 +0000 Subject: [PATCH] Use GL_BGRA instead of GL_RGBA when creating textures. GL_BGRA is the native format, and should be faster since it doesn't require any internal swizzling. svn path=/trunk/KDE/kdebase/workspace/; revision=1102455 --- lib/kwinglutils.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/kwinglutils.cpp b/lib/kwinglutils.cpp index 0e23144c4e..343ef3dd00 100644 --- a/lib/kwinglutils.cpp +++ b/lib/kwinglutils.cpp @@ -374,7 +374,7 @@ GLTexture::GLTexture( int width, int height ) glGenTextures( 1, &mTexture ); bind(); - glTexImage2D( mTarget, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + glTexImage2D( mTarget, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0); unbind(); } } @@ -451,8 +451,8 @@ bool GLTexture::load( const QImage& image, GLenum target ) if( isNull()) glGenTextures( 1, &mTexture ); bind(); - glTexImage2D( mTarget, 0, GL_RGBA, img.width(), img.height(), 0, - GL_RGBA, GL_UNSIGNED_BYTE, img.bits()); + glTexImage2D( mTarget, 0, GL_RGBA8, img.width(), img.height(), 0, + GL_BGRA, GL_UNSIGNED_BYTE, img.bits()); unbind(); return true; } @@ -721,7 +721,7 @@ static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum textu QImage GLTexture::convertToGLFormat( const QImage& img ) const { // Copied from Qt's QGLWidget::convertToGLFormat() QImage res(img.size(), QImage::Format_ARGB32); - convertToGLFormatHelper(res, img.convertToFormat(QImage::Format_ARGB32), GL_RGBA); + convertToGLFormatHelper(res, img.convertToFormat(QImage::Format_ARGB32), GL_BGRA); return res; }