summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-07-31 16:46:47 +0900
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-08-07 09:34:59 +0000
commit127768880d44881defa937a98d222df321a47262 (patch)
tree2fe3f30908956faa73cf2975c655864ef31abd10
parent22421a4083529e852fc6d290c2cc8c7611e9150b (diff)
opengl: support reading 8bit texture (fixes icon corruption)
Change-Id: Iba3fd58374a550f3411b02f029f12f4509fb6048 (cherry picked from commit f73e1f50240208257964e28e0e65a56e323d86da) Reviewed-on: https://gerrit.libreoffice.org/17559 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--vcl/opengl/salbmp.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 982de8b3a9be..7b7f674bde7d 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -368,7 +368,7 @@ GLuint OpenGLSalBitmap::CreateTexture()
else
{
// convert to 32 bits RGBA using palette
- pData = new sal_uInt8[ mnBufHeight * (mnBufWidth << 2) ];
+ pData = new sal_uInt8[mnBufHeight * mnBufWidth * 4];
bAllocated = true;
nFormat = GL_RGBA;
nType = GL_UNSIGNED_BYTE;
@@ -424,13 +424,16 @@ bool OpenGLSalBitmap::ReadTexture()
if( pData == NULL )
return false;
- if( mnBits == 16 || mnBits == 24 || mnBits == 32 )
+ if (mnBits == 8 || mnBits == 16 || mnBits == 24 || mnBits == 32)
{
// no conversion needed for truecolor
pData = maUserBuffer.get();
switch( mnBits )
{
+ case 8: nFormat = GL_LUMINANCE;
+ nType = GL_UNSIGNED_BYTE;
+ break;
case 16: nFormat = GL_RGB;
nType = GL_UNSIGNED_SHORT_5_6_5;
break;