Kaydet (Commit) 12776888 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Miklos Vajna

opengl: support reading 8bit texture (fixes icon corruption)

Change-Id: Iba3fd58374a550f3411b02f029f12f4509fb6048
(cherry picked from commit f73e1f50)
Reviewed-on: https://gerrit.libreoffice.org/17559Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 22421a40
...@@ -368,7 +368,7 @@ GLuint OpenGLSalBitmap::CreateTexture() ...@@ -368,7 +368,7 @@ GLuint OpenGLSalBitmap::CreateTexture()
else else
{ {
// convert to 32 bits RGBA using palette // convert to 32 bits RGBA using palette
pData = new sal_uInt8[ mnBufHeight * (mnBufWidth << 2) ]; pData = new sal_uInt8[mnBufHeight * mnBufWidth * 4];
bAllocated = true; bAllocated = true;
nFormat = GL_RGBA; nFormat = GL_RGBA;
nType = GL_UNSIGNED_BYTE; nType = GL_UNSIGNED_BYTE;
...@@ -424,13 +424,16 @@ bool OpenGLSalBitmap::ReadTexture() ...@@ -424,13 +424,16 @@ bool OpenGLSalBitmap::ReadTexture()
if( pData == NULL ) if( pData == NULL )
return false; return false;
if( mnBits == 16 || mnBits == 24 || mnBits == 32 ) if (mnBits == 8 || mnBits == 16 || mnBits == 24 || mnBits == 32)
{ {
// no conversion needed for truecolor // no conversion needed for truecolor
pData = maUserBuffer.get(); pData = maUserBuffer.get();
switch( mnBits ) switch( mnBits )
{ {
case 8: nFormat = GL_LUMINANCE;
nType = GL_UNSIGNED_BYTE;
break;
case 16: nFormat = GL_RGB; case 16: nFormat = GL_RGB;
nType = GL_UNSIGNED_SHORT_5_6_5; nType = GL_UNSIGNED_SHORT_5_6_5;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment