summaryrefslogtreecommitdiff
path: root/vcl/opengl/salbmp.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-03-21 15:04:25 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-03-21 15:14:45 +0100
commitebe247642d85d39b6e1ffae3cf92c31748f2e983 (patch)
tree2d7ef84826a9be1ae3a2cb1d37d497c471b2cdc8 /vcl/opengl/salbmp.cxx
parent17407f808ed0ca5d65a98da186f7e2ab60dc641b (diff)
Revert "tdf#116213 OS X and OpenGL bitmap scaline sizes are not 32-bit aligned"
This reverts commit 460f39e687393b3a8906d2adc3e8f7a0c749851a. For one, it had started to make bitmap checksum equality check in svx/qa/unit/XTableImportExportTest.cxx, CppunitTest_svx_unit, fail most of the time in macOS --disable-dbgutil builds, as the bitmap checksum is now computed also over padding bytes containing random values (but --enable-dbgutil initializes those bytes). And why would fixing tdf#116213 for Windows require touching the macOS-specific code, anyway? For another, tdf#116213 comments 6 and 7 report further problems that are likely linked to this commit. Change-Id: I3e158813ab89a1ead3780abbf6b120ec52660231
Diffstat (limited to 'vcl/opengl/salbmp.cxx')
-rw-r--r--vcl/opengl/salbmp.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index a83c2c820e0f..69c6c5481c35 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -81,13 +81,18 @@ inline bool isValidBitCount( sal_uInt16 nBitCount )
sal_uInt32 lclBytesPerRow(sal_uInt16 nBits, int nWidth)
{
- assert ((nBits == 1 || nBits == 4 || nBits == 8 || nBits == 16 || nBits == 24 || nBits == 32)
- && "vcl::OpenGLSalBitmap::AllocateUserData(), illegal bitcount!");
-
- if (!isValidBitCount(nBits))
- return 0;
-
- return AlignedWidth4Bytes(nBits * nWidth);
+ switch(nBits)
+ {
+ case 1: return (nWidth + 7) >> 3;
+ case 4: return (nWidth + 1) >> 1;
+ case 8: return nWidth;
+ case 16: return nWidth * 2;
+ case 24: return nWidth * 3;
+ case 32: return nWidth * 4;
+ default:
+ OSL_FAIL("vcl::OpenGLSalBitmap::AllocateUserData(), illegal bitcount!");
+ }
+ return 0;
}
typedef std::vector<std::unique_ptr< FixedTextureAtlasManager > > TextureAtlasVector;