slideshow/source/engine/activitiesqueue.cxx | 4 slideshow/source/engine/eventqueue.cxx | 4 slideshow/source/engine/rehearsetimingsactivity.cxx | 4 slideshow/source/engine/shapesubset.cxx | 4 slideshow/source/engine/slide/userpaintoverlay.cxx | 4 slideshow/source/engine/transitions/shapetransitionfactory.cxx | 4 slideshow/source/engine/usereventqueue.cxx | 4 vcl/source/gdi/dibtools.cxx | 311 +++++----- 8 files changed, 173 insertions(+), 166 deletions(-)
New commits: commit ea9a31e3f130de74ebca0e5e5c1f450c6bca4a5b Author: Caolán McNamara <caol...@redhat.com> Date: Sun Apr 16 14:47:12 2017 +0100 logging the simple message is sufficient Change-Id: I50050001f080f668bded036372feeb271da4a7c6 diff --git a/slideshow/source/engine/activitiesqueue.cxx b/slideshow/source/engine/activitiesqueue.cxx index 4a159c2b9509..531e421ab6f4 100644 --- a/slideshow/source/engine/activitiesqueue.cxx +++ b/slideshow/source/engine/activitiesqueue.cxx @@ -55,9 +55,9 @@ namespace slideshow for( const auto& pActivity : maCurrentActivitiesReinsert ) pActivity->dispose(); } - catch (const uno::Exception&) + catch (const uno::Exception& e) { - SAL_WARN( "slideshow", "" << comphelper::anyToString(cppu::getCaughtException() ) ); + SAL_WARN("slideshow", "" << e.Message); } } diff --git a/slideshow/source/engine/eventqueue.cxx b/slideshow/source/engine/eventqueue.cxx index bcf8d1b685a5..2cb928cc3436 100644 --- a/slideshow/source/engine/eventqueue.cxx +++ b/slideshow/source/engine/eventqueue.cxx @@ -73,9 +73,9 @@ namespace slideshow { maEvents.top().pEvent->dispose(); } - catch (const uno::Exception&) + catch (const uno::Exception& e) { - SAL_WARN( "slideshow", "" << comphelper::anyToString(cppu::getCaughtException() ) ); + SAL_WARN("slideshow", "" << e.Message); } maEvents.pop(); } diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx index d7f6291d9121..861edc70144e 100644 --- a/slideshow/source/engine/rehearsetimingsactivity.cxx +++ b/slideshow/source/engine/rehearsetimingsactivity.cxx @@ -179,9 +179,9 @@ RehearseTimingsActivity::~RehearseTimingsActivity() { stop(); } - catch (const uno::Exception&) + catch (const uno::Exception& e) { - SAL_WARN( "slideshow", "" << comphelper::anyToString(cppu::getCaughtException() ) ); + SAL_WARN("slideshow", "" << e.Message); } } diff --git a/slideshow/source/engine/shapesubset.cxx b/slideshow/source/engine/shapesubset.cxx index 46c0d0c8d2c3..1155797d7ca7 100644 --- a/slideshow/source/engine/shapesubset.cxx +++ b/slideshow/source/engine/shapesubset.cxx @@ -79,9 +79,9 @@ namespace slideshow // if not done yet: revoke subset from original disableSubsetShape(); } - catch (const uno::Exception&) + catch (const uno::Exception& e) { - SAL_WARN( "slideshow", "" << comphelper::anyToString(cppu::getCaughtException() ) ); + SAL_WARN("slideshow", "" << e.Message); } } diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx index 3657de8937a3..46f780e89bf9 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.cxx +++ b/slideshow/source/engine/slide/userpaintoverlay.cxx @@ -487,9 +487,9 @@ namespace slideshow mrMultiplexer.removeViewHandler( mpHandler ); mpHandler->dispose(); } - catch (const uno::Exception&) + catch (const uno::Exception& e) { - SAL_WARN( "slideshow", "" << comphelper::anyToString(cppu::getCaughtException() ) ); + SAL_WARN("slideshow", "" << e.Message); } } } diff --git a/slideshow/source/engine/transitions/shapetransitionfactory.cxx b/slideshow/source/engine/transitions/shapetransitionfactory.cxx index 8b46d97a33c7..9195c64f186b 100644 --- a/slideshow/source/engine/transitions/shapetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/shapetransitionfactory.cxx @@ -110,9 +110,9 @@ ClippingAnimation::~ClippingAnimation() { end_(); } - catch (const uno::Exception&) + catch (const uno::Exception& e) { - SAL_WARN( "slideshow", "" << comphelper::anyToString(cppu::getCaughtException() ) ); + SAL_WARN("slideshow", "" << e.Message); } } diff --git a/slideshow/source/engine/usereventqueue.cxx b/slideshow/source/engine/usereventqueue.cxx index 9db191331c11..6bcfd5c9bfa8 100644 --- a/slideshow/source/engine/usereventqueue.cxx +++ b/slideshow/source/engine/usereventqueue.cxx @@ -558,9 +558,9 @@ UserEventQueue::~UserEventQueue() // unregister all handlers clear(); } - catch (const uno::Exception&) + catch (const uno::Exception& e) { - SAL_WARN( "slideshow", "" << comphelper::anyToString(cppu::getCaughtException() ) ); + SAL_WARN("slideshow", "" << e.Message); } } commit 487f349184013d718fe2a82336bfe0fec1bfd612 Author: Caolán McNamara <caol...@redhat.com> Date: Sun Apr 16 14:38:12 2017 +0100 return false on exception Change-Id: I478724b2842eed847c28fdd90c95ea86c80e86f4 diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index dc3666978fb7..1b0b2aee4e11 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -1389,185 +1389,192 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess* bool ImplWriteDIBBody(const Bitmap& rBitmap, SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess* pAccAlpha, bool bCompressed) { - const MapMode aMapPixel(MapUnit::MapPixel); - DIBV5Header aHeader; - sal_uLong nImageSizePos(0); - sal_uLong nEndPos(0); - sal_uInt32 nCompression(COMPRESS_NONE); - bool bRet(false); - - aHeader.nSize = pAccAlpha ? DIBV5HEADERSIZE : DIBINFOHEADERSIZE; // size dependent on CF_DIB type to use - aHeader.nWidth = rAcc.Width(); - aHeader.nHeight = rAcc.Height(); - aHeader.nPlanes = 1; - - if(!pAccAlpha && isBitfieldCompression(rAcc.GetScanlineFormat())) + try { - aHeader.nBitCount = (ScanlineFormat::N16BitTcLsbMask == rAcc.GetScanlineFormat()) ? 16 : 32; - aHeader.nSizeImage = rAcc.Height() * rAcc.GetScanlineSize(); - nCompression = BITFIELDS; - } - else - { - // #i5xxx# Limit bitcount to 24bit, the 32 bit cases are - // not handled properly below (would have to set color - // masks, and nCompression=BITFIELDS - but color mask is - // not set for formats != *_TC_*). Note that this very - // problem might cause trouble at other places - the - // introduction of 32 bit RGBA bitmaps is relatively - // recent. - // #i59239# discretize bitcount to 1,4,8,24 (other cases - // are not written below) - const sal_uInt16 nBitCount(pAccAlpha ? 32 : discretizeBitcount(rAcc.GetBitCount())); - aHeader.nBitCount = nBitCount; - aHeader.nSizeImage = rAcc.Height() * AlignedWidth4Bytes(rAcc.Width() * aHeader.nBitCount); - - if(bCompressed) + const MapMode aMapPixel(MapUnit::MapPixel); + DIBV5Header aHeader; + sal_uLong nImageSizePos(0); + sal_uLong nEndPos(0); + sal_uInt32 nCompression(COMPRESS_NONE); + bool bRet(false); + + aHeader.nSize = pAccAlpha ? DIBV5HEADERSIZE : DIBINFOHEADERSIZE; // size dependent on CF_DIB type to use + aHeader.nWidth = rAcc.Width(); + aHeader.nHeight = rAcc.Height(); + aHeader.nPlanes = 1; + + if(!pAccAlpha && isBitfieldCompression(rAcc.GetScanlineFormat())) { - if(4 == nBitCount) - { - nCompression = RLE_4; - } - else if(8 == nBitCount) + aHeader.nBitCount = (ScanlineFormat::N16BitTcLsbMask == rAcc.GetScanlineFormat()) ? 16 : 32; + aHeader.nSizeImage = rAcc.Height() * rAcc.GetScanlineSize(); + nCompression = BITFIELDS; + } + else + { + // #i5xxx# Limit bitcount to 24bit, the 32 bit cases are + // not handled properly below (would have to set color + // masks, and nCompression=BITFIELDS - but color mask is + // not set for formats != *_TC_*). Note that this very + // problem might cause trouble at other places - the + // introduction of 32 bit RGBA bitmaps is relatively + // recent. + // #i59239# discretize bitcount to 1,4,8,24 (other cases + // are not written below) + const sal_uInt16 nBitCount(pAccAlpha ? 32 : discretizeBitcount(rAcc.GetBitCount())); + aHeader.nBitCount = nBitCount; + aHeader.nSizeImage = rAcc.Height() * AlignedWidth4Bytes(rAcc.Width() * aHeader.nBitCount); + + if(bCompressed) { - nCompression = RLE_8; + if(4 == nBitCount) + { + nCompression = RLE_4; + } + else if(8 == nBitCount) + { + nCompression = RLE_8; + } } } - } - - if((rOStm.GetCompressMode() & SvStreamCompressFlags::ZBITMAP) && (rOStm.GetVersion() >= SOFFICE_FILEFORMAT_40)) - { - aHeader.nCompression = ZCOMPRESS; - } - else - { - aHeader.nCompression = nCompression; - } - if(rBitmap.GetPrefSize().Width() && rBitmap.GetPrefSize().Height() && (rBitmap.GetPrefMapMode() != aMapPixel)) - { - // #i48108# Try to recover xpels/ypels as previously stored on - // disk. The problem with just converting maPrefSize to 100th - // mm and then relating that to the bitmap pixel size is that - // MapMode is integer-based, and suffers from roundoffs, - // especially if maPrefSize is small. Trying to circumvent - // that by performing part of the math in floating point. - const Size aScale100000(OutputDevice::LogicToLogic(Size(100000, 100000), MapUnit::Map100thMM, rBitmap.GetPrefMapMode())); - const double fBmpWidthM((double)rBitmap.GetPrefSize().Width() / aScale100000.Width()); - const double fBmpHeightM((double)rBitmap.GetPrefSize().Height() / aScale100000.Height()); - - if(!basegfx::fTools::equalZero(fBmpWidthM) && !basegfx::fTools::equalZero(fBmpHeightM)) + if((rOStm.GetCompressMode() & SvStreamCompressFlags::ZBITMAP) && (rOStm.GetVersion() >= SOFFICE_FILEFORMAT_40)) { - aHeader.nXPelsPerMeter = basegfx::fround(rAcc.Width() / fabs(fBmpWidthM)); - aHeader.nYPelsPerMeter = basegfx::fround(rAcc.Height() / fabs(fBmpHeightM)); + aHeader.nCompression = ZCOMPRESS; + } + else + { + aHeader.nCompression = nCompression; } - } - - aHeader.nColsUsed = ((!pAccAlpha && aHeader.nBitCount <= 8) ? rAcc.GetPaletteEntryCount() : 0); - aHeader.nColsImportant = 0; - rOStm.WriteUInt32( aHeader.nSize ); - rOStm.WriteInt32( aHeader.nWidth ); - rOStm.WriteInt32( aHeader.nHeight ); - rOStm.WriteUInt16( aHeader.nPlanes ); - rOStm.WriteUInt16( aHeader.nBitCount ); - rOStm.WriteUInt32( aHeader.nCompression ); + if(rBitmap.GetPrefSize().Width() && rBitmap.GetPrefSize().Height() && (rBitmap.GetPrefMapMode() != aMapPixel)) + { + // #i48108# Try to recover xpels/ypels as previously stored on + // disk. The problem with just converting maPrefSize to 100th + // mm and then relating that to the bitmap pixel size is that + // MapMode is integer-based, and suffers from roundoffs, + // especially if maPrefSize is small. Trying to circumvent + // that by performing part of the math in floating point. + const Size aScale100000(OutputDevice::LogicToLogic(Size(100000, 100000), MapUnit::Map100thMM, rBitmap.GetPrefMapMode())); + const double fBmpWidthM((double)rBitmap.GetPrefSize().Width() / aScale100000.Width()); + const double fBmpHeightM((double)rBitmap.GetPrefSize().Height() / aScale100000.Height()); + + if(!basegfx::fTools::equalZero(fBmpWidthM) && !basegfx::fTools::equalZero(fBmpHeightM)) + { + aHeader.nXPelsPerMeter = basegfx::fround(rAcc.Width() / fabs(fBmpWidthM)); + aHeader.nYPelsPerMeter = basegfx::fround(rAcc.Height() / fabs(fBmpHeightM)); + } + } - nImageSizePos = rOStm.Tell(); - rOStm.SeekRel( sizeof( aHeader.nSizeImage ) ); + aHeader.nColsUsed = ((!pAccAlpha && aHeader.nBitCount <= 8) ? rAcc.GetPaletteEntryCount() : 0); + aHeader.nColsImportant = 0; - rOStm.WriteInt32( aHeader.nXPelsPerMeter ); - rOStm.WriteInt32( aHeader.nYPelsPerMeter ); - rOStm.WriteUInt32( aHeader.nColsUsed ); - rOStm.WriteUInt32( aHeader.nColsImportant ); + rOStm.WriteUInt32( aHeader.nSize ); + rOStm.WriteInt32( aHeader.nWidth ); + rOStm.WriteInt32( aHeader.nHeight ); + rOStm.WriteUInt16( aHeader.nPlanes ); + rOStm.WriteUInt16( aHeader.nBitCount ); + rOStm.WriteUInt32( aHeader.nCompression ); - if(pAccAlpha) // only write DIBV5 when asked to do so - { - aHeader.nV5CSType = 0x57696E20; // LCS_WINDOWS_COLOR_SPACE - aHeader.nV5Intent = 0x00000004; // LCS_GM_IMAGES - - rOStm.WriteUInt32( aHeader.nV5RedMask ); - rOStm.WriteUInt32( aHeader.nV5GreenMask ); - rOStm.WriteUInt32( aHeader.nV5BlueMask ); - rOStm.WriteUInt32( aHeader.nV5AlphaMask ); - rOStm.WriteUInt32( aHeader.nV5CSType ); - - rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzRed.aXyzX ); - rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzRed.aXyzY ); - rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzRed.aXyzZ ); - rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzGreen.aXyzX ); - rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzGreen.aXyzY ); - rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzGreen.aXyzZ ); - rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzBlue.aXyzX ); - rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzBlue.aXyzY ); - rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzBlue.aXyzZ ); - - rOStm.WriteUInt32( aHeader.nV5GammaRed ); - rOStm.WriteUInt32( aHeader.nV5GammaGreen ); - rOStm.WriteUInt32( aHeader.nV5GammaBlue ); - rOStm.WriteUInt32( aHeader.nV5Intent ); - rOStm.WriteUInt32( aHeader.nV5ProfileData ); - rOStm.WriteUInt32( aHeader.nV5ProfileSize ); - rOStm.WriteUInt32( aHeader.nV5Reserved ); - } + nImageSizePos = rOStm.Tell(); + rOStm.SeekRel( sizeof( aHeader.nSizeImage ) ); - if(ZCOMPRESS == aHeader.nCompression) - { - ZCodec aCodec; - SvMemoryStream aMemStm(aHeader.nSizeImage + 4096, 65535); - sal_uLong nCodedPos(rOStm.Tell()); - sal_uLong nLastPos(0); - sal_uInt32 nCodedSize(0); - sal_uInt32 nUncodedSize(0); + rOStm.WriteInt32( aHeader.nXPelsPerMeter ); + rOStm.WriteInt32( aHeader.nYPelsPerMeter ); + rOStm.WriteUInt32( aHeader.nColsUsed ); + rOStm.WriteUInt32( aHeader.nColsImportant ); - // write uncoded data palette - if(aHeader.nColsUsed) + if(pAccAlpha) // only write DIBV5 when asked to do so { - ImplWriteDIBPalette(aMemStm, rAcc); + aHeader.nV5CSType = 0x57696E20; // LCS_WINDOWS_COLOR_SPACE + aHeader.nV5Intent = 0x00000004; // LCS_GM_IMAGES + + rOStm.WriteUInt32( aHeader.nV5RedMask ); + rOStm.WriteUInt32( aHeader.nV5GreenMask ); + rOStm.WriteUInt32( aHeader.nV5BlueMask ); + rOStm.WriteUInt32( aHeader.nV5AlphaMask ); + rOStm.WriteUInt32( aHeader.nV5CSType ); + + rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzRed.aXyzX ); + rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzRed.aXyzY ); + rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzRed.aXyzZ ); + rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzGreen.aXyzX ); + rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzGreen.aXyzY ); + rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzGreen.aXyzZ ); + rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzBlue.aXyzX ); + rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzBlue.aXyzY ); + rOStm.WriteInt32( aHeader.aV5Endpoints.aXyzBlue.aXyzZ ); + + rOStm.WriteUInt32( aHeader.nV5GammaRed ); + rOStm.WriteUInt32( aHeader.nV5GammaGreen ); + rOStm.WriteUInt32( aHeader.nV5GammaBlue ); + rOStm.WriteUInt32( aHeader.nV5Intent ); + rOStm.WriteUInt32( aHeader.nV5ProfileData ); + rOStm.WriteUInt32( aHeader.nV5ProfileSize ); + rOStm.WriteUInt32( aHeader.nV5Reserved ); } - // write uncoded bits - bRet = ImplWriteDIBBits(aMemStm, rAcc, pAccAlpha, nCompression, aHeader.nSizeImage); + if(ZCOMPRESS == aHeader.nCompression) + { + ZCodec aCodec; + SvMemoryStream aMemStm(aHeader.nSizeImage + 4096, 65535); + sal_uLong nCodedPos(rOStm.Tell()); + sal_uLong nLastPos(0); + sal_uInt32 nCodedSize(0); + sal_uInt32 nUncodedSize(0); + + // write uncoded data palette + if(aHeader.nColsUsed) + { + ImplWriteDIBPalette(aMemStm, rAcc); + } - // get uncoded size - nUncodedSize = aMemStm.Tell(); + // write uncoded bits + bRet = ImplWriteDIBBits(aMemStm, rAcc, pAccAlpha, nCompression, aHeader.nSizeImage); - // seek over compress info - rOStm.SeekRel(12); + // get uncoded size + nUncodedSize = aMemStm.Tell(); - // write compressed data - aCodec.BeginCompression(3); - aCodec.Write(rOStm, static_cast<sal_uInt8 const *>(aMemStm.GetData()), nUncodedSize); - aCodec.EndCompression(); + // seek over compress info + rOStm.SeekRel(12); - // update compress info ( coded size, uncoded size, uncoded compression ) - nLastPos = rOStm.Tell(); - nCodedSize = nLastPos - nCodedPos - 12; - rOStm.Seek(nCodedPos); - rOStm.WriteUInt32( nCodedSize ).WriteUInt32( nUncodedSize ).WriteUInt32( nCompression ); - rOStm.Seek(nLastPos); + // write compressed data + aCodec.BeginCompression(3); + aCodec.Write(rOStm, static_cast<sal_uInt8 const *>(aMemStm.GetData()), nUncodedSize); + aCodec.EndCompression(); - if(bRet) - { - bRet = (ERRCODE_NONE == rOStm.GetError()); + // update compress info ( coded size, uncoded size, uncoded compression ) + nLastPos = rOStm.Tell(); + nCodedSize = nLastPos - nCodedPos - 12; + rOStm.Seek(nCodedPos); + rOStm.WriteUInt32( nCodedSize ).WriteUInt32( nUncodedSize ).WriteUInt32( nCompression ); + rOStm.Seek(nLastPos); + + if(bRet) + { + bRet = (ERRCODE_NONE == rOStm.GetError()); + } } - } - else - { - if(aHeader.nColsUsed) + else { - ImplWriteDIBPalette(rOStm, rAcc); - } + if(aHeader.nColsUsed) + { + ImplWriteDIBPalette(rOStm, rAcc); + } - bRet = ImplWriteDIBBits(rOStm, rAcc, pAccAlpha, aHeader.nCompression, aHeader.nSizeImage); - } + bRet = ImplWriteDIBBits(rOStm, rAcc, pAccAlpha, aHeader.nCompression, aHeader.nSizeImage); + } - nEndPos = rOStm.Tell(); - rOStm.Seek(nImageSizePos); - rOStm.WriteUInt32( aHeader.nSizeImage ); - rOStm.Seek(nEndPos); + nEndPos = rOStm.Tell(); + rOStm.Seek(nImageSizePos); + rOStm.WriteUInt32( aHeader.nSizeImage ); + rOStm.Seek(nEndPos); - return bRet; + return bRet; + } + catch (...) + { + return false; + } } bool ImplWriteDIBFileHeader(SvStream& rOStm, BitmapReadAccess& rAcc, bool bUseDIBV5)
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits