vcl/source/bitmap/dibtools.cxx | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
New commits: commit bc1323e8976a994d0ed7dbe275414f531236cbe8 Author: Mike Kaganski <[email protected]> AuthorDate: Sun Nov 9 15:37:30 2025 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Sun Nov 9 16:08:12 2025 +0100 Simplify a bit BitmapScopedReadAccess may be scoped to the `if`, and then it doesn't need explicit reset. The inner `if` can be deduplicated, which IMO improves clarity. Change-Id: I002d3353bc12ab42095122c65c85a2b839d543fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193660 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/vcl/source/bitmap/dibtools.cxx b/vcl/source/bitmap/dibtools.cxx index 1b9a4e6d79d8..c43274b1e3ea 100644 --- a/vcl/source/bitmap/dibtools.cxx +++ b/vcl/source/bitmap/dibtools.cxx @@ -1570,27 +1570,17 @@ bool ImplWriteDIB( if(!aSizePix.Width() || !aSizePix.Height()) return false; - BitmapScopedReadAccess pAcc(rSource); const SvStreamEndian nOldFormat(rOStm.GetEndian()); const sal_uInt64 nOldPos(rOStm.Tell()); rOStm.SetEndian(SvStreamEndian::LITTLE); - if (pAcc) + if (BitmapScopedReadAccess pAcc{ rSource }) { - if(bFileHeader) - { - if(ImplWriteDIBFileHeader(rOStm, *pAcc)) - { - bRet = ImplWriteDIBBody(rSource, rOStm, *pAcc, bCompressed); - } - } - else + if (!bFileHeader || ImplWriteDIBFileHeader(rOStm, *pAcc)) { bRet = ImplWriteDIBBody(rSource, rOStm, *pAcc, bCompressed); } - - pAcc.reset(); } if(!bRet)
