diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2016-01-09 21:25:12 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2016-01-11 10:07:46 +0000 |
commit | c332ed4794dc0ae818416b36aa5295a9dd34c9c6 (patch) | |
tree | c4e92398dcaa24ad4a00aeec88e5eecd4eb34477 /vcl | |
parent | 1b2a60dbde98034125aa30551c12bcf0d1c420b8 (diff) |
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@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/opengl/salbmp.cxx | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index 9e59e231c1ec..03497dc44921 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; |