Kaydet (Commit) 3c115cd0 authored tarafından Andrzej Hunt's avatar Andrzej Hunt

Use SolarMutexGuard instead of pairs of Acquire/ReleaseSolarMutex

Change-Id: I7ff41dd932fd9860dff944b3bf8ff5bdc230ae5d
üst 5ee87e86
...@@ -466,11 +466,8 @@ static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart) ...@@ -466,11 +466,8 @@ static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart)
return; return;
} }
Application::AcquireSolarMutex(1); SolarMutexGuard aGuard;
{ pDoc->setPart( nPart );
pDoc->setPart( nPart );
}
Application::ReleaseSolarMutex();
} }
static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart) static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart)
...@@ -504,31 +501,29 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis, ...@@ -504,31 +501,29 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis,
return; 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->setPart( nCurrentPart );
}
pDoc->setPartMode(ePartMode); else
{
// We need to make sure the internal state is updated, just changing the mode pDoc->setPart( 0 );
// 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 );
}
} }
Application::ReleaseSolarMutex();
} }
void doc_paintTile (LibreOfficeKitDocument* pThis, void doc_paintTile (LibreOfficeKitDocument* pThis,
...@@ -550,38 +545,36 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, ...@@ -550,38 +545,36 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
return; return;
} }
Application::AcquireSolarMutex(1); SolarMutexGuard aGuard;
{
#if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS) #if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS)
ImplSVData* pSVData = ImplGetSVData(); ImplSVData* pSVData = ImplGetSVData();
SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst); SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst);
pSalInstance->setBitCountFormatMapping( 32, ::basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA ); pSalInstance->setBitCountFormatMapping( 32, ::basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA );
VirtualDevice aDevice(0, (sal_uInt16)32); VirtualDevice aDevice(0, (sal_uInt16)32);
boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() ); boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() );
aDevice.SetOutputSizePixelScaleOffsetAndBuffer( aDevice.SetOutputSizePixelScaleOffsetAndBuffer(
Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
aBuffer, true ); aBuffer, true );
pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight, pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight,
nTilePosX, nTilePosY, nTileWidth, nTileHeight); nTilePosX, nTilePosY, nTileWidth, nTileHeight);
SvpSalVirtualDevice* pSalDev = static_cast< SvpSalVirtualDevice* >(aDevice.getSalVirtualDevice()); SvpSalVirtualDevice* pSalDev = static_cast< SvpSalVirtualDevice* >(aDevice.getSalVirtualDevice());
basebmp::BitmapDeviceSharedPtr pBmpDev = pSalDev->getBitmapDevice(); basebmp::BitmapDeviceSharedPtr pBmpDev = pSalDev->getBitmapDevice();
*pRowStride = pBmpDev->getScanlineStride(); *pRowStride = pBmpDev->getScanlineStride();
#else #else
(void) pBuffer; (void) pBuffer;
(void) nCanvasWidth; (void) nCanvasWidth;
(void) nCanvasHeight; (void) nCanvasHeight;
(void) pRowStride; (void) pRowStride;
(void) nTilePosX; (void) nTilePosX;
(void) nTilePosY; (void) nTilePosY;
(void) nTileWidth; (void) nTileWidth;
(void) nTileHeight; (void) nTileHeight;
#endif #endif
}
Application::ReleaseSolarMutex();
} }
static void doc_getDocumentSize(LibreOfficeKitDocument* pThis, static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment