diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-03-12 15:22:18 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-13 05:17:26 +0000 |
commit | b8261a99ae537078e0bc1c62154fc6c66c7556b4 (patch) | |
tree | 28a1bbca33e40ec07600542152d102382757efea /vcl | |
parent | 48670533998f078525f7dad94b89bc371a5b3947 (diff) |
improve readability
and make it easier to debug.
top crasher in 5.3.0.3 is around this area:
https://cgit.freedesktop.org/libreoffice/core/tree/vcl/source/gdi/
bmpacc2.cxx?h=libreoffice-5.3.0.3#n235
http://crashreport.libreoffice.org/stats/signature/
BitmapReadAccess::GetPixelForN32BitTcRgba(
unsigned%20char%20const%20*,long,ColorMask%20const%20&)#summary
in case someone wonders suffix increment '++' precedes dereference '*'
Change-Id: I15876711db569d55739da3514f61ef1b981269ab
Reviewed-on: https://gerrit.libreoffice.org/35099
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/bmpacc2.cxx | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx index 83391d1b4921..ab67ddda9d3e 100644 --- a/vcl/source/gdi/bmpacc2.cxx +++ b/vcl/source/gdi/bmpacc2.cxx @@ -127,7 +127,8 @@ BitmapColor BitmapReadAccess::GetPixelForN24BitTcBgr(ConstScanline pScanline, lo { BitmapColor aBitmapColor; - aBitmapColor.SetBlue( *( pScanline = pScanline + nX * 3 )++ ); + pScanline = pScanline + nX * 3; + aBitmapColor.SetBlue( *pScanline++ ); aBitmapColor.SetGreen( *pScanline++ ); aBitmapColor.SetRed( *pScanline ); @@ -136,7 +137,8 @@ BitmapColor BitmapReadAccess::GetPixelForN24BitTcBgr(ConstScanline pScanline, lo void BitmapReadAccess::SetPixelForN24BitTcBgr(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { - *( pScanline = pScanline + nX * 3 )++ = rBitmapColor.GetBlue(); + pScanline = pScanline + nX * 3; + *pScanline++ = rBitmapColor.GetBlue(); *pScanline++ = rBitmapColor.GetGreen(); *pScanline = rBitmapColor.GetRed(); } @@ -145,7 +147,8 @@ BitmapColor BitmapReadAccess::GetPixelForN24BitTcRgb(ConstScanline pScanline, lo { BitmapColor aBitmapColor; - aBitmapColor.SetRed( *( pScanline = pScanline + nX * 3 )++ ); + pScanline = pScanline + nX * 3; + aBitmapColor.SetRed( *pScanline++ ); aBitmapColor.SetGreen( *pScanline++ ); aBitmapColor.SetBlue( *pScanline ); @@ -154,7 +157,8 @@ BitmapColor BitmapReadAccess::GetPixelForN24BitTcRgb(ConstScanline pScanline, lo void BitmapReadAccess::SetPixelForN24BitTcRgb(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { - *( pScanline = pScanline + nX * 3 )++ = rBitmapColor.GetRed(); + pScanline = pScanline + nX * 3; + *pScanline++ = rBitmapColor.GetRed(); *pScanline++ = rBitmapColor.GetGreen(); *pScanline = rBitmapColor.GetBlue(); } @@ -163,7 +167,8 @@ BitmapColor BitmapReadAccess::GetPixelForN32BitTcAbgr(ConstScanline pScanline, l { BitmapColor aBitmapColor; - aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ ); + pScanline = pScanline + ( nX << 2 ) + 1; + aBitmapColor.SetBlue( *pScanline++ ); aBitmapColor.SetGreen( *pScanline++ ); aBitmapColor.SetRed( *pScanline ); @@ -172,7 +177,8 @@ BitmapColor BitmapReadAccess::GetPixelForN32BitTcAbgr(ConstScanline pScanline, l void BitmapReadAccess::SetPixelForN32BitTcAbgr(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { - *( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF; + pScanline = pScanline + ( nX << 2 ); + *pScanline++ = 0xFF; *pScanline++ = rBitmapColor.GetBlue(); *pScanline++ = rBitmapColor.GetGreen(); *pScanline = rBitmapColor.GetRed(); @@ -182,7 +188,8 @@ BitmapColor BitmapReadAccess::GetPixelForN32BitTcArgb(ConstScanline pScanline, l { BitmapColor aBitmapColor; - aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ ); + pScanline = pScanline + ( nX << 2 ) + 1; + aBitmapColor.SetRed( *pScanline++ ); aBitmapColor.SetGreen( *pScanline++ ); aBitmapColor.SetBlue( *pScanline ); @@ -191,7 +198,8 @@ BitmapColor BitmapReadAccess::GetPixelForN32BitTcArgb(ConstScanline pScanline, l void BitmapReadAccess::SetPixelForN32BitTcArgb(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { - *( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF; + pScanline = pScanline + ( nX << 2 ); + *pScanline++ = 0xFF; *pScanline++ = rBitmapColor.GetRed(); *pScanline++ = rBitmapColor.GetGreen(); *pScanline = rBitmapColor.GetBlue(); @@ -201,7 +209,8 @@ BitmapColor BitmapReadAccess::GetPixelForN32BitTcBgra(ConstScanline pScanline, l { BitmapColor aBitmapColor; - aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) )++ ); + pScanline = pScanline + ( nX << 2 ); + aBitmapColor.SetBlue( *pScanline++ ); aBitmapColor.SetGreen( *pScanline++ ); aBitmapColor.SetRed( *pScanline ); @@ -210,7 +219,8 @@ BitmapColor BitmapReadAccess::GetPixelForN32BitTcBgra(ConstScanline pScanline, l void BitmapReadAccess::SetPixelForN32BitTcBgra(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { - *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetBlue(); + pScanline = pScanline + ( nX << 2 ); + *pScanline++ = rBitmapColor.GetBlue(); *pScanline++ = rBitmapColor.GetGreen(); *pScanline++ = rBitmapColor.GetRed(); *pScanline = 0xFF; @@ -220,7 +230,8 @@ BitmapColor BitmapReadAccess::GetPixelForN32BitTcRgba(ConstScanline pScanline, l { BitmapColor aBitmapColor; - aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) )++ ); + pScanline = pScanline + ( nX << 2 ); + aBitmapColor.SetRed( *pScanline++ ); aBitmapColor.SetGreen( *pScanline++ ); aBitmapColor.SetBlue( *pScanline ); @@ -229,7 +240,8 @@ BitmapColor BitmapReadAccess::GetPixelForN32BitTcRgba(ConstScanline pScanline, l void BitmapReadAccess::SetPixelForN32BitTcRgba(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { - *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetRed(); + pScanline = pScanline + ( nX << 2 ); + *pScanline++ = rBitmapColor.GetRed(); *pScanline++ = rBitmapColor.GetGreen(); *pScanline++ = rBitmapColor.GetBlue(); *pScanline = 0xFF; |