diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-30 15:16:49 +0200 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-31 12:31:36 +0200 |
commit | 3c115cd0474ac19240f491f6dcd1f1ec994a60da (patch) | |
tree | 877e4195d681935130787bebd6fe3ddef10f18f6 /desktop | |
parent | 5ee87e861e3147d6a3a9411296cd2498d77555db (diff) |
Use SolarMutexGuard instead of pairs of Acquire/ReleaseSolarMutex
Change-Id: I7ff41dd932fd9860dff944b3bf8ff5bdc230ae5d
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 99 |
1 files changed, 46 insertions, 53 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 138b8f5dd3b5..bc38cc2720be 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -466,11 +466,8 @@ static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart) return; } - Application::AcquireSolarMutex(1); - { - pDoc->setPart( nPart ); - } - Application::ReleaseSolarMutex(); + SolarMutexGuard aGuard; + pDoc->setPart( nPart ); } static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart) @@ -504,31 +501,29 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis, return; } - Application::AcquireSolarMutex(1); + SolarMutexGuard aGuard; + + int nCurrentPart = pDoc->getPart(); + + pDoc->setPartMode(ePartMode); + + // We need to make sure the internal state is updated, just changing the mode + // might not update the relevant shells (i.e. impress will keep rendering the + // previous mode unless we do this). + // TODO: we might want to do this within the relevant components rather than + // here, but that's also dependent on how we implement embedded object + // rendering I guess? + // TODO: we could be clever and e.g. set to 0 when we change to/from + // embedded object mode, and not when changing between slide/notes/combined + // modes? + if ( nCurrentPart < pDoc->getParts() ) { - int nCurrentPart = pDoc->getPart(); - - pDoc->setPartMode(ePartMode); - - // We need to make sure the internal state is updated, just changing the mode - // might not update the relevant shells (i.e. impress will keep rendering the - // previous mode unless we do this). - // TODO: we might want to do this within the relevant components rather than - // here, but that's also dependent on how we implement embedded object - // rendering I guess? - // TODO: we could be clever and e.g. set to 0 when we change to/from - // embedded object mode, and not when changing between slide/notes/combined - // modes? - if ( nCurrentPart < pDoc->getParts() ) - { - pDoc->setPart( nCurrentPart ); - } - else - { - pDoc->setPart( 0 ); - } + pDoc->setPart( nCurrentPart ); + } + else + { + pDoc->setPart( 0 ); } - Application::ReleaseSolarMutex(); } void doc_paintTile (LibreOfficeKitDocument* pThis, @@ -550,38 +545,36 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, return; } - Application::AcquireSolarMutex(1); - { + SolarMutexGuard aGuard; + #if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS) - ImplSVData* pSVData = ImplGetSVData(); - SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst); - pSalInstance->setBitCountFormatMapping( 32, ::basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA ); + ImplSVData* pSVData = ImplGetSVData(); + SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst); + pSalInstance->setBitCountFormatMapping( 32, ::basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA ); - VirtualDevice aDevice(0, (sal_uInt16)32); - boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() ); - aDevice.SetOutputSizePixelScaleOffsetAndBuffer( - Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), - aBuffer, true ); + VirtualDevice aDevice(0, (sal_uInt16)32); + boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() ); + aDevice.SetOutputSizePixelScaleOffsetAndBuffer( + Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), + aBuffer, true ); - pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight, - nTilePosX, nTilePosY, nTileWidth, nTileHeight); + pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight, + nTilePosX, nTilePosY, nTileWidth, nTileHeight); - SvpSalVirtualDevice* pSalDev = static_cast< SvpSalVirtualDevice* >(aDevice.getSalVirtualDevice()); - basebmp::BitmapDeviceSharedPtr pBmpDev = pSalDev->getBitmapDevice(); + SvpSalVirtualDevice* pSalDev = static_cast< SvpSalVirtualDevice* >(aDevice.getSalVirtualDevice()); + basebmp::BitmapDeviceSharedPtr pBmpDev = pSalDev->getBitmapDevice(); - *pRowStride = pBmpDev->getScanlineStride(); + *pRowStride = pBmpDev->getScanlineStride(); #else - (void) pBuffer; - (void) nCanvasWidth; - (void) nCanvasHeight; - (void) pRowStride; - (void) nTilePosX; - (void) nTilePosY; - (void) nTileWidth; - (void) nTileHeight; + (void) pBuffer; + (void) nCanvasWidth; + (void) nCanvasHeight; + (void) pRowStride; + (void) nTilePosX; + (void) nTilePosY; + (void) nTileWidth; + (void) nTileHeight; #endif - } - Application::ReleaseSolarMutex(); } static void doc_getDocumentSize(LibreOfficeKitDocument* pThis, |