[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - vcl/opengl

Michael Meeks michael.meeks at collabora.com
Mon Jan 11 02:08:20 PST 2016


 vcl/opengl/salbmp.cxx |   24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

New commits:
commit c332ed4794dc0ae818416b36aa5295a9dd34c9c6
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat Jan 9 21:25:12 2016 +0000

    tdf#96550 - vcl opengl - fix BGR/RGB swap for some 8-bit icons.
    
    Change-Id: Ic71b8a94cabc392e7b83df70c1691de8f4c12b43
    Reviewed-on: https://gerrit.libreoffice.org/21295
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 9e59e23..03497dc 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -472,13 +472,25 @@ GLuint OpenGLSalBitmap::CreateTexture()
                 pSrcFormat->StartLine( pSrcData );
 
                 sal_uInt32 nX = mnBufWidth;
-                while( nX-- )
+                if (nFormat == GL_BGR)
                 {
-                    const BitmapColor& c = pSrcFormat->ReadPixel();
-
-                    *pDstData++ = c.GetRed();
-                    *pDstData++ = c.GetGreen();
-                    *pDstData++ = c.GetBlue();
+                    while( nX-- )
+                    {
+                        const BitmapColor& c = pSrcFormat->ReadPixel();
+                        *pDstData++ = c.GetBlue();
+                        *pDstData++ = c.GetGreen();
+                        *pDstData++ = c.GetRed();
+                    }
+                }
+                else // RGB
+                {
+                    while( nX-- )
+                    {
+                        const BitmapColor& c = pSrcFormat->ReadPixel();
+                        *pDstData++ = c.GetRed();
+                        *pDstData++ = c.GetGreen();
+                        *pDstData++ = c.GetBlue();
+                    }
                 }
 
                 pSrcData += mnBytesPerRow;


More information about the Libreoffice-commits mailing list