diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-03-14 11:27:09 +1100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2014-03-14 11:22:33 +0000 |
commit | 0d88e15a8a3fa7fba6471c832d7df3cfd61da962 (patch) | |
tree | 4f45e5ac6180a9d748ee32c3375b55e460f35859 /vcl | |
parent | 9b7f17dd3087d6926ee51e4d66f0ce3a3ab90867 (diff) |
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/8581
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/print.cxx | 17 | ||||
-rw-r--r-- | vcl/source/gdi/virdev.cxx | 11 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 10 |
3 files changed, 19 insertions, 19 deletions
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 7eca283e557f..92a7d3d7f486 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -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 ) diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index bb9d37fd5ab1..3e962fdbb54d 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -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 ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index d4a0087740f7..f57e3842e35f 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -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(); } } } |