diff options
-rw-r--r-- | include/vcl/outdev.hxx | 6 | ||||
-rw-r--r-- | include/vcl/print.hxx | 2 | ||||
-rw-r--r-- | include/vcl/virdev.hxx | 1 | ||||
-rw-r--r-- | include/vcl/window.hxx | 1 | ||||
-rw-r--r-- | vcl/source/gdi/outdev.cxx | 140 | ||||
-rw-r--r-- | vcl/source/gdi/print.cxx | 84 | ||||
-rw-r--r-- | vcl/source/gdi/virdev.cxx | 32 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 31 |
8 files changed, 180 insertions, 117 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index c53955650ad3..67b7a1f435e8 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -352,6 +352,10 @@ private: mutable bool mbRefPoint : 1; mutable bool mbEnableRTL : 1; + +protected: + virtual void ImplReleaseFonts(); + public: /** @name Initialization and accessor functions */ @@ -393,7 +397,7 @@ public: @param bRelease Determines whether to release the fonts of the physically released graphics device. */ - SAL_DLLPRIVATE void ImplReleaseGraphics( bool bRelease = true ); + virtual void ImplReleaseGraphics( bool bRelease = true ) = 0; /** Initialize the graphics device's data structures. */ diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 2e8098d38376..0f5897d241c3 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -248,6 +248,8 @@ private: Link maErrorHdl; bool ImplInitGraphics() const; + void ImplReleaseGraphics( bool bRelease = true ); + void ImplReleaseFonts(); SAL_DLLPRIVATE void ImplInitData(); SAL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo ); SAL_DLLPRIVATE void ImplInitDisplay( const Window* pWindow ); diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index b78495d24e16..72cc3fe95e84 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -62,6 +62,7 @@ private: { return ((meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD) != 0); } public: bool ImplInitGraphics() const; + void ImplReleaseGraphics( bool bRelease = true ); public: /** Create a virtual device of size 1x1 diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 62aa5c8b3219..8d76850eb7fc 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -375,6 +375,7 @@ private: public: SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData ); bool ImplInitGraphics() const; + void ImplReleaseGraphics( bool bRelease = true ); SAL_DLLPRIVATE WinBits ImplInitRes( const ResId& rResId ); SAL_DLLPRIVATE WindowResHeader ImplLoadResHeader( const ResId& rResId ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 762f2bdb3729..8518345772db 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -551,134 +551,42 @@ SalGraphics const *OutputDevice::ImplGetGraphics() const return mpGraphics; } -void OutputDevice::ImplReleaseGraphics( bool bRelease ) +void OutputDevice::ImplInitOutDevData() { - DBG_TESTSOLARMUTEX(); - - if ( !mpGraphics ) - return; - - // release the fonts of the physically released graphics device - if( bRelease ) + if ( !mpOutDevData ) { -#ifndef UNX - // HACK to fix an urgent P1 printing issue fast - // WinSalPrinter does not respect GetGraphics/ReleaseGraphics conventions - // so Printer::mpGraphics often points to a dead WinSalGraphics - // TODO: fix WinSalPrinter's GetGraphics/ReleaseGraphics handling - if( meOutDevType != OUTDEV_PRINTER ) -#endif - mpGraphics->ReleaseFonts(); - - mbNewFont = true; - mbInitFont = true; - - if ( mpFontEntry ) - { - mpFontCache->Release( mpFontEntry ); - mpFontEntry = NULL; - } - - if ( mpGetDevFontList ) - { - delete mpGetDevFontList; - mpGetDevFontList = NULL; - } + mpOutDevData = new ImplOutDevData; + mpOutDevData->mpRotateDev = NULL; + mpOutDevData->mpRecordLayout = NULL; - if ( mpGetDevSizeList ) - { - delete mpGetDevSizeList; - mpGetDevSizeList = NULL; - } + // #i75163# + mpOutDevData->mpViewTransform = NULL; + mpOutDevData->mpInverseViewTransform = NULL; } +} - ImplSVData* pSVData = ImplGetSVData(); - if ( meOutDevType == OUTDEV_WINDOW ) - { - Window* pWindow = (Window*)this; +void OutputDevice::ImplReleaseFonts() +{ + mpGraphics->ReleaseFonts(); + mbNewFont = true; + mbInitFont = true; - if ( bRelease ) - pWindow->mpWindowImpl->mpFrame->ReleaseGraphics( mpGraphics ); - // remove from global LRU list of window graphics - if ( mpPrevGraphics ) - mpPrevGraphics->mpNextGraphics = mpNextGraphics; - else - pSVData->maGDIData.mpFirstWinGraphics = mpNextGraphics; - if ( mpNextGraphics ) - mpNextGraphics->mpPrevGraphics = mpPrevGraphics; - else - pSVData->maGDIData.mpLastWinGraphics = mpPrevGraphics; - } - else if ( meOutDevType == OUTDEV_VIRDEV ) + if ( mpFontEntry ) { - VirtualDevice* pVirDev = (VirtualDevice*)this; - - if ( bRelease ) - pVirDev->mpVirDev->ReleaseGraphics( mpGraphics ); - // remove from global LRU list of virtual device graphics - if ( mpPrevGraphics ) - mpPrevGraphics->mpNextGraphics = mpNextGraphics; - else - pSVData->maGDIData.mpFirstVirGraphics = mpNextGraphics; - if ( mpNextGraphics ) - mpNextGraphics->mpPrevGraphics = mpPrevGraphics; - else - pSVData->maGDIData.mpLastVirGraphics = mpPrevGraphics; + mpFontCache->Release( mpFontEntry ); + mpFontEntry = NULL; } - else if ( meOutDevType == OUTDEV_PRINTER ) - { - Printer* pPrinter = (Printer*)this; - if ( !pPrinter->mpJobGraphics ) - { - if ( pPrinter->mpDisplayDev ) - { - VirtualDevice* pVirDev = pPrinter->mpDisplayDev; - if ( bRelease ) - pVirDev->mpVirDev->ReleaseGraphics( mpGraphics ); - // remove from global LRU list of virtual device graphics - if ( mpPrevGraphics ) - mpPrevGraphics->mpNextGraphics = mpNextGraphics; - else - pSVData->maGDIData.mpFirstVirGraphics = mpNextGraphics; - if ( mpNextGraphics ) - mpNextGraphics->mpPrevGraphics = mpPrevGraphics; - else - pSVData->maGDIData.mpLastVirGraphics = mpPrevGraphics; - } - else - { - if ( bRelease ) - pPrinter->mpInfoPrinter->ReleaseGraphics( mpGraphics ); - // remove from global LRU list of printer graphics - if ( mpPrevGraphics ) - mpPrevGraphics->mpNextGraphics = mpNextGraphics; - else - pSVData->maGDIData.mpFirstPrnGraphics = mpNextGraphics; - if ( mpNextGraphics ) - mpNextGraphics->mpPrevGraphics = mpPrevGraphics; - else - pSVData->maGDIData.mpLastPrnGraphics = mpPrevGraphics; - } - } + if ( mpGetDevFontList ) + { + delete mpGetDevFontList; + mpGetDevFontList = NULL; } - mpGraphics = NULL; - mpPrevGraphics = NULL; - mpNextGraphics = NULL; -} - -void OutputDevice::ImplInitOutDevData() -{ - if ( !mpOutDevData ) + if ( mpGetDevSizeList ) { - mpOutDevData = new ImplOutDevData; - mpOutDevData->mpRotateDev = NULL; - mpOutDevData->mpRecordLayout = NULL; - - // #i75163# - mpOutDevData->mpViewTransform = NULL; - mpOutDevData->mpInverseViewTransform = NULL; + delete mpGetDevSizeList; + mpGetDevSizeList = NULL; } } diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index dca6ef3ee5e2..3f1acd120daa 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -527,6 +527,90 @@ bool Printer::ImplInitGraphics() const return mpGraphics ? true : false; } +void Printer::ImplReleaseFonts() +{ +#ifndef UNX + // HACK to fix an urgent P1 printing issue fast + // WinSalPrinter does not respect GetGraphics/ReleaseGraphics conventions + // so Printer::mpGraphics often points to a dead WinSalGraphics + // TODO: fix WinSalPrinter's GetGraphics/ReleaseGraphics handling + mpGraphics->ReleaseFonts(); +#endif + mbNewFont = true; + mbInitFont = true; + + if ( mpFontEntry ) + { + mpFontCache->Release( mpFontEntry ); + mpFontEntry = NULL; + } + + if ( mpGetDevFontList ) + { + delete mpGetDevFontList; + mpGetDevFontList = NULL; + } + + if ( mpGetDevSizeList ) + { + delete mpGetDevSizeList; + mpGetDevSizeList = NULL; + } +} + +void Printer::ImplReleaseGraphics( bool bRelease ) +{ + DBG_TESTSOLARMUTEX(); + + if ( !mpGraphics ) + return; + + // release the fonts of the physically released graphics device + if( bRelease ) + ImplReleaseFonts(); + + ImplSVData* pSVData = ImplGetSVData(); + + Printer* pPrinter = (Printer*)this; + + if ( !pPrinter->mpJobGraphics ) + { + if ( pPrinter->mpDisplayDev ) + { + VirtualDevice* pVirDev = pPrinter->mpDisplayDev; + if ( bRelease ) + pVirDev->mpVirDev->ReleaseGraphics( mpGraphics ); + // remove from global LRU list of virtual device graphics + if ( mpPrevGraphics ) + mpPrevGraphics->mpNextGraphics = mpNextGraphics; + else + pSVData->maGDIData.mpFirstVirGraphics = mpNextGraphics; + if ( mpNextGraphics ) + mpNextGraphics->mpPrevGraphics = mpPrevGraphics; + else + pSVData->maGDIData.mpLastVirGraphics = mpPrevGraphics; + } + else + { + if ( bRelease ) + pPrinter->mpInfoPrinter->ReleaseGraphics( mpGraphics ); + // remove from global LRU list of printer graphics + if ( mpPrevGraphics ) + mpPrevGraphics->mpNextGraphics = mpNextGraphics; + else + pSVData->maGDIData.mpFirstPrnGraphics = mpNextGraphics; + if ( mpNextGraphics ) + mpNextGraphics->mpPrevGraphics = mpPrevGraphics; + else + pSVData->maGDIData.mpLastPrnGraphics = mpPrevGraphics; + } + } + + mpGraphics = NULL; + mpPrevGraphics = NULL; + mpNextGraphics = NULL; +} + void Printer::ImplInit( SalPrinterQueueInfo* pInfo ) { ImplSVData* pSVData = ImplGetSVData(); diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index cf8ab485212e..68789c805e90 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -82,6 +82,38 @@ bool VirtualDevice::ImplInitGraphics() const return mpGraphics ? true : false; } +void VirtualDevice::ImplReleaseGraphics( bool bRelease ) +{ + DBG_TESTSOLARMUTEX(); + + if ( !mpGraphics ) + return; + + // release the fonts of the physically released graphics device + if ( bRelease ) + ImplReleaseFonts(); + + ImplSVData* pSVData = ImplGetSVData(); + + VirtualDevice* pVirDev = (VirtualDevice*)this; + + if ( bRelease ) + pVirDev->mpVirDev->ReleaseGraphics( mpGraphics ); + // remove from global LRU list of virtual device graphics + if ( mpPrevGraphics ) + mpPrevGraphics->mpNextGraphics = mpNextGraphics; + else + pSVData->maGDIData.mpFirstVirGraphics = mpNextGraphics; + if ( mpNextGraphics ) + mpNextGraphics->mpPrevGraphics = mpPrevGraphics; + else + pSVData->maGDIData.mpLastVirGraphics = mpPrevGraphics; + + mpGraphics = NULL; + mpPrevGraphics = NULL; + mpNextGraphics = NULL; +} + void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) { diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index f56c2e1f821f..dbb2c5f3b476 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -420,6 +420,37 @@ bool Window::ImplInitGraphics() const return mpGraphics ? true : false; } +void Window::ImplReleaseGraphics( bool bRelease ) +{ + DBG_TESTSOLARMUTEX(); + + if ( !mpGraphics ) + return; + + // release the fonts of the physically released graphics device + if( bRelease ) + ImplReleaseFonts(); + + ImplSVData* pSVData = ImplGetSVData(); + + Window* pWindow = (Window*)this; + + if ( bRelease ) + pWindow->mpWindowImpl->mpFrame->ReleaseGraphics( mpGraphics ); + // remove from global LRU list of window graphics + if ( mpPrevGraphics ) + mpPrevGraphics->mpNextGraphics = mpNextGraphics; + else + pSVData->maGDIData.mpFirstWinGraphics = mpNextGraphics; + if ( mpNextGraphics ) + mpNextGraphics->mpPrevGraphics = mpPrevGraphics; + else + pSVData->maGDIData.mpLastWinGraphics = mpPrevGraphics; + + mpGraphics = NULL; + mpPrevGraphics = NULL; + mpNextGraphics = NULL; +} bool Window::HasMirroredGraphics() const { |