summaryrefslogtreecommitdiff
path: root/vcl/quartz/salbmp.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/quartz/salbmp.cxx')
-rw-r--r--vcl/quartz/salbmp.cxx15
1 files changed, 3 insertions, 12 deletions
diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index f9a10a44020b..04fb820b08a3 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -310,19 +310,10 @@ bool QuartzSalBitmap::AllocateUserData()
if( mnWidth && mnHeight )
{
- mnBytesPerRow = 0;
+ assert((mnBits == 1 || mnBits == 4 || mnBits == 8 || mnBits == 16 || mnBits == 24 || mnBits == 32)
+ && "vcl::QuartzSalBitmap::AllocateUserData(), illegal bitcount!");
- switch( mnBits )
- {
- case 1: mnBytesPerRow = (mnWidth + 7) >> 3; break;
- case 4: mnBytesPerRow = (mnWidth + 1) >> 1; break;
- case 8: mnBytesPerRow = mnWidth; break;
- case 16: mnBytesPerRow = mnWidth << 1; break;
- case 24: mnBytesPerRow = (mnWidth << 1) + mnWidth; break;
- case 32: mnBytesPerRow = mnWidth << 2; break;
- default:
- OSL_FAIL("vcl::QuartzSalBitmap::AllocateUserData(), illegal bitcount!");
- }
+ mnBytesPerRow = AlignedWidth4Bytes(mnBits * mnWidth);
}
bool alloc = false;