[Libreoffice-commits] core.git: vcl/source
Chris Sherlock
chris.sherlock79 at gmail.com
Fri Mar 14 04:22:56 PDT 2014
vcl/source/gdi/print.cxx | 17 +++++++++--------
vcl/source/gdi/virdev.cxx | 11 ++++++-----
vcl/source/window/window.cxx | 10 ++++------
3 files changed, 19 insertions(+), 19 deletions(-)
New commits:
commit 0d88e15a8a3fa7fba6471c832d7df3cfd61da962
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Fri Mar 14 11:27:09 2014 +1100
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 at collabora.com>
Tested-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 7eca283..92a7d3d 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 bb9d37f..3e962fd 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 d4a0087..f57e384 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();
}
}
}
More information about the Libreoffice-commits
mailing list