vcl/source/gdi/dibtools.cxx | 72 ++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 36 deletions(-)
New commits: commit b9d4e76f27b66037c2e2ac4c3738b975e9e773aa Author: David Tardon <dtar...@redhat.com> Date: Fri Jan 22 19:18:47 2016 +0100 limit variable scope Change-Id: I961d1378f81b511be3173c61206b53983841abbe (cherry picked from commit eae3881b92ece4ce7ad93dd836e396b0ad44d16b) Reviewed-on: https://gerrit.libreoffice.org/21789 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index 10c70e9..3c1bc0d 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) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits