Kaydet (Commit) 0d88e15a authored tarafından Chris Sherlock's avatar Chris Sherlock Kaydeden (comit) Michael Meeks

fdo#74702 Return true if graphics is set, cleanup unused variables

If mpGraphics is set, then return true as initialization of graphics
device has already been done. I've also removed unnecessary variables
which were a left over from the function splits.

Change-Id: I25c25b93b9db2c112c9a1aea278b1ec3e0590303
Reviewed-on: https://gerrit.libreoffice.org/8581Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst 9b7f17dd
......@@ -458,6 +458,9 @@ bool Printer::ImplInitGraphics() const
{
DBG_TESTSOLARMUTEX();
if ( mpGraphics )
return true;
mbInitLineColor = true;
mbInitFillColor = true;
mbInitFont = true;
......@@ -466,13 +469,11 @@ bool Printer::ImplInitGraphics() const
ImplSVData* pSVData = ImplGetSVData();
const Printer* pPrinter = (const Printer*)this;
if ( pPrinter->mpJobGraphics )
mpGraphics = pPrinter->mpJobGraphics;
else if ( pPrinter->mpDisplayDev )
if ( mpJobGraphics )
mpGraphics = mpJobGraphics;
else if ( mpDisplayDev )
{
const VirtualDevice* pVirDev = pPrinter->mpDisplayDev;
const VirtualDevice* pVirDev = mpDisplayDev;
mpGraphics = pVirDev->mpVirDev->AcquireGraphics();
// if needed retry after releasing least recently used virtual device graphics
while ( !mpGraphics )
......@@ -495,14 +496,14 @@ bool Printer::ImplInitGraphics() const
}
else
{
mpGraphics = pPrinter->mpInfoPrinter->AcquireGraphics();
mpGraphics = mpInfoPrinter->AcquireGraphics();
// if needed retry after releasing least recently used printer graphics
while ( !mpGraphics )
{
if ( !pSVData->maGDIData.mpLastPrnGraphics )
break;
pSVData->maGDIData.mpLastPrnGraphics->ImplReleaseGraphics();
mpGraphics = pPrinter->mpInfoPrinter->AcquireGraphics();
mpGraphics = mpInfoPrinter->AcquireGraphics();
}
// update global LRU list of printer graphics
if ( mpGraphics )
......
......@@ -38,6 +38,9 @@ bool VirtualDevice::ImplInitGraphics() const
{
DBG_TESTSOLARMUTEX();
if ( mpGraphics )
return true;
mbInitLineColor = true;
mbInitFillColor = true;
mbInitFont = true;
......@@ -46,18 +49,16 @@ bool VirtualDevice::ImplInitGraphics() const
ImplSVData* pSVData = ImplGetSVData();
const VirtualDevice* pVirDev = (const VirtualDevice*)this;
if ( pVirDev->mpVirDev )
if ( mpVirDev )
{
mpGraphics = pVirDev->mpVirDev->AcquireGraphics();
mpGraphics = mpVirDev->AcquireGraphics();
// if needed retry after releasing least recently used virtual device graphics
while ( !mpGraphics )
{
if ( !pSVData->maGDIData.mpLastVirGraphics )
break;
pSVData->maGDIData.mpLastVirGraphics->ImplReleaseGraphics();
mpGraphics = pVirDev->mpVirDev->AcquireGraphics();
mpGraphics = mpVirDev->AcquireGraphics();
}
// update global LRU list of virtual device graphics
if ( mpGraphics )
......
......@@ -357,7 +357,7 @@ bool Window::ImplInitGraphics() const
DBG_TESTSOLARMUTEX();
if ( mpGraphics )
return mpGraphics;
return true;
mbInitLineColor = true;
mbInitFillColor = true;
......@@ -367,9 +367,7 @@ bool Window::ImplInitGraphics() const
ImplSVData* pSVData = ImplGetSVData();
Window* pWindow = (Window*)this;
mpGraphics = pWindow->mpWindowImpl->mpFrame->AcquireGraphics();
mpGraphics = mpWindowImpl->mpFrame->AcquireGraphics();
// try harder if no wingraphics was available directly
if ( !mpGraphics )
{
......@@ -377,7 +375,7 @@ bool Window::ImplInitGraphics() const
OutputDevice* pReleaseOutDev = pSVData->maGDIData.mpLastWinGraphics;
while ( pReleaseOutDev )
{
if ( ((Window*)pReleaseOutDev)->mpWindowImpl->mpFrame == pWindow->mpWindowImpl->mpFrame )
if ( ((Window*)pReleaseOutDev)->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame )
break;
pReleaseOutDev = pReleaseOutDev->mpPrevGraphics;
}
......@@ -396,7 +394,7 @@ bool Window::ImplInitGraphics() const
if ( !pSVData->maGDIData.mpLastWinGraphics )
break;
pSVData->maGDIData.mpLastWinGraphics->ImplReleaseGraphics();
mpGraphics = pWindow->mpWindowImpl->mpFrame->AcquireGraphics();
mpGraphics = mpWindowImpl->mpFrame->AcquireGraphics();
}
}
}
......
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