diff options
author | David Tardon <dtardon@redhat.com> | 2016-01-22 19:18:47 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-01 13:01:01 +0000 |
commit | b9d4e76f27b66037c2e2ac4c3738b975e9e773aa (patch) | |
tree | 8058fa1cc2fdda7daeea8354fac223cb897bcbff /vcl/source | |
parent | 326418924702ef3a991db13c8d3e0f844985dada (diff) |
limit variable scope
Change-Id: I961d1378f81b511be3173c61206b53983841abbe
(cherry picked from commit eae3881b92ece4ce7ad93dd836e396b0ad44d16b)
Reviewed-on: https://gerrit.libreoffice.org/21789
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/dibtools.cxx | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index 10c70e93a38d..3c1bc0dea29e 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -761,42 +761,6 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon } const sal_uInt16 nBitCount(discretizeBitcount(aHeader.nBitCount)); - const Size aSizePixel(aHeader.nWidth, aHeader.nHeight); - BitmapPalette aDummyPal; - Bitmap aNewBmp(aSizePixel, nBitCount, &aDummyPal); - BitmapWriteAccess* pAcc = aNewBmp.AcquireWriteAccess(); - if (!pAcc) - return false; - if (pAcc->Width() != aHeader.nWidth || pAcc->Height() != aHeader.nHeight) - { - Bitmap::ReleaseAccess(pAcc); - return false; - } - Bitmap aNewBmpAlpha; - BitmapWriteAccess* pAccAlpha = nullptr; - bool bAlphaPossible(pBmpAlpha && aHeader.nBitCount == 32); - - if (bAlphaPossible) - { - const bool bRedSet(0 != aHeader.nV5RedMask); - const bool bGreenSet(0 != aHeader.nV5GreenMask); - const bool bBlueSet(0 != aHeader.nV5BlueMask); - - // some clipboard entries have alpha mask on zero to say that there is - // no alpha; do only use this when the other masks are set. The MS docu - // says that masks are only to be set when bV5Compression is set to - // BI_BITFIELDS, but there seem to exist a wild variety of usages... - if((bRedSet || bGreenSet || bBlueSet) && (0 == aHeader.nV5AlphaMask)) - { - bAlphaPossible = false; - } - } - - if (bAlphaPossible) - { - aNewBmpAlpha = Bitmap(aSizePixel, 8); - pAccAlpha = aNewBmpAlpha.AcquireWriteAccess(); - } sal_uInt16 nColors(0); SvStream* pIStm; @@ -885,6 +849,42 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon pIStm = &rIStm; } + const Size aSizePixel(aHeader.nWidth, aHeader.nHeight); + BitmapPalette aDummyPal; + Bitmap aNewBmp(aSizePixel, nBitCount, &aDummyPal); + BitmapWriteAccess* pAcc = aNewBmp.AcquireWriteAccess(); + if (!pAcc) + return false; + if (pAcc->Width() != aHeader.nWidth || pAcc->Height() != aHeader.nHeight) + { + Bitmap::ReleaseAccess(pAcc); + return false; + } + Bitmap aNewBmpAlpha; + BitmapWriteAccess* pAccAlpha = nullptr; + bool bAlphaPossible(pBmpAlpha && aHeader.nBitCount == 32); + + if (bAlphaPossible) + { + const bool bRedSet(0 != aHeader.nV5RedMask); + const bool bGreenSet(0 != aHeader.nV5GreenMask); + const bool bBlueSet(0 != aHeader.nV5BlueMask); + + // some clipboard entries have alpha mask on zero to say that there is + // no alpha; do only use this when the other masks are set. The MS docu + // says that masks are only to be set when bV5Compression is set to + // BI_BITFIELDS, but there seem to exist a wild variety of usages... + if((bRedSet || bGreenSet || bBlueSet) && (0 == aHeader.nV5AlphaMask)) + { + bAlphaPossible = false; + } + } + + if (bAlphaPossible) + { + aNewBmpAlpha = Bitmap(aSizePixel, 8); + pAccAlpha = aNewBmpAlpha.AcquireWriteAccess(); + } // read palette if(nColors) { |