summaryrefslogtreecommitdiff
path: root/vcl/opengl/salbmp.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2016-11-03 23:05:25 +0100
committerTomaž Vajngerl <quikee@gmail.com>2016-11-04 15:53:48 +0000
commit6b571ae4608ac15256eb7582f442ce69975370f3 (patch)
treec76fdd06a8ba38678297ab48889e62a41604a24c /vcl/opengl/salbmp.cxx
parentc52d1403c3b9874bd1454093e0379e8766679609 (diff)
opengl: change from BGRA to RGBA color arrangement on Windows
BGRA is native color arrangement on Windows however some intel drivers have problems with large textures if they read from a BGRA buffer. So with this commit we switch to RGBA color arrangement. This shouldn't cause much performance differences, but we need to convert from RGBA to BGRA when printing. Change-Id: Ic112dc6a6c5d8b70e96041d0de15a03bbbdc406f Reviewed-on: https://gerrit.libreoffice.org/30544 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/opengl/salbmp.cxx')
-rw-r--r--vcl/opengl/salbmp.cxx40
1 files changed, 1 insertions, 39 deletions
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index fde9f199157d..bce9fb7850c0 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -55,28 +55,16 @@ inline bool determineTextureFormat(sal_uInt16 nBits, GLenum& nFormat, GLenum& nT
nType = GL_UNSIGNED_BYTE;
return true;
case 16:
-#ifdef _WIN32
- nFormat = GL_BGR;
-#else
nFormat = GL_RGB;
-#endif
nType = GL_UNSIGNED_SHORT_5_6_5;
return true;
case 24:
-#ifdef _WIN32
- nFormat = GL_BGR;
-#else
nFormat = GL_RGB;
-#endif
nType = GL_UNSIGNED_BYTE;
return true;
case 32:
-#ifdef _WIN32
- nFormat = GL_BGRA;
-#else
nFormat = GL_RGBA;
-#endif
- nType = GL_UNSIGNED_BYTE;
+ nType = GL_UNSIGNED_INT_8_8_8_8;
return true;
default:
break;
@@ -783,16 +771,6 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode )
break;
case 16:
{
-#ifdef _WIN32
- pBuffer->mnFormat = ScanlineFormat::N16BitTcLsbMask;
- ColorMaskElement aRedMask(0x00007c00);
- aRedMask.CalcMaskShift();
- ColorMaskElement aGreenMask(0x000003e0);
- aGreenMask.CalcMaskShift();
- ColorMaskElement aBlueMask(0x0000001f);
- aBlueMask.CalcMaskShift();
- pBuffer->maColorMask = ColorMask(aRedMask, aGreenMask, aBlueMask);
-#else
pBuffer->mnFormat = ScanlineFormat::N16BitTcMsbMask;
ColorMaskElement aRedMask(0x0000f800);
aRedMask.CalcMaskShift();
@@ -801,30 +779,15 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode )
ColorMaskElement aBlueMask(0x0000001f);
aBlueMask.CalcMaskShift();
pBuffer->maColorMask = ColorMask(aRedMask, aGreenMask, aBlueMask);
-#endif
break;
}
case 24:
{
-#ifdef _WIN32
- pBuffer->mnFormat = ScanlineFormat::N24BitTcBgr;
-#else
pBuffer->mnFormat = ScanlineFormat::N24BitTcRgb;
-#endif
break;
}
case 32:
{
-#ifdef _WIN32
- pBuffer->mnFormat = ScanlineFormat::N32BitTcBgra;
- ColorMaskElement aRedMask(0x00ff0000);
- aRedMask.CalcMaskShift();
- ColorMaskElement aGreenMask(0x0000ff00);
- aGreenMask.CalcMaskShift();
- ColorMaskElement aBlueMask(0x000000ff);
- aBlueMask.CalcMaskShift();
- pBuffer->maColorMask = ColorMask(aRedMask, aGreenMask, aBlueMask);
-#else
pBuffer->mnFormat = ScanlineFormat::N32BitTcRgba;
ColorMaskElement aRedMask(0xff000000);
aRedMask.CalcMaskShift();
@@ -833,7 +796,6 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode )
ColorMaskElement aBlueMask(0x0000ff00);
aBlueMask.CalcMaskShift();
pBuffer->maColorMask = ColorMask(aRedMask, aGreenMask, aBlueMask);
-#endif
break;
}
}