[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Aug 20 12:40:27 UTC 2018
include/vcl/outdev.hxx | 2 +-
vcl/inc/svdata.hxx | 2 +-
vcl/inc/window.h | 4 ++--
vcl/source/app/svmain.cxx | 5 ++---
vcl/source/gdi/print.cxx | 13 +++++--------
vcl/source/gdi/virdev.cxx | 7 +++----
vcl/source/outdev/font.cxx | 20 +++++++++-----------
vcl/source/outdev/outdev.cxx | 10 +---------
vcl/source/window/window.cxx | 6 +++---
9 files changed, 27 insertions(+), 42 deletions(-)
New commits:
commit 7d44fb6d97f629839bb896142ccb4ce0c55db707
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Aug 19 18:21:01 2018 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Aug 20 14:40:05 2018 +0200
TODO: refcount ImplFontCache
Change-Id: Ia4499c2a1515aebaff9edf0e843fc66c7fb1414e
Reviewed-on: https://gerrit.libreoffice.org/59309
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 553baf20e591..28dab9a0df9c 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -339,7 +339,7 @@ private:
mutable VclPtr<OutputDevice> mpNextGraphics; ///< Next output device in list
GDIMetaFile* mpMetaFile;
mutable rtl::Reference<LogicalFontInstance> mpFontInstance;
- mutable ImplFontCache* mpFontCache;
+ mutable std::shared_ptr<ImplFontCache> mxFontCache;
mutable PhysicalFontCollection* mpFontCollection;
mutable std::unique_ptr<ImplDeviceFontList> mpDeviceFontList;
mutable std::unique_ptr<ImplDeviceFontSizeList> mpDeviceFontSizeList;
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 407f1ceff165..7b35a0283e93 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -185,7 +185,7 @@ struct ImplSVGDIData
VclPtr<Printer> mpLastPrinter; // Last Printer
ImplPrnQueueList* mpPrinterQueueList = nullptr; // List of all printer queue
PhysicalFontCollection* mpScreenFontList = nullptr; // Screen-Font-List
- ImplFontCache* mpScreenFontCache = nullptr; // Screen-Font-Cache
+ std::shared_ptr<ImplFontCache> mxScreenFontCache; // Screen-Font-Cache
ImplDirectFontSubstitution* mpDirectFontSubst = nullptr; // Font-Substitutions defined in Tools->Options->Fonts
GraphicConverter* mpGrfConverter = nullptr; // Converter for graphics
long mnAppFontX = 0; // AppFont X-Numenator for 40/tel Width
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 0e2ee4a7cb6f..f1a5f66ef830 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -127,9 +127,9 @@ struct ImplFrameData
VclPtr<vcl::Window> mpFocusWin; //< focus window (is also set, when frame doesn't have the focus)
VclPtr<vcl::Window> mpMouseMoveWin; //< last window, where MouseMove() called
VclPtr<vcl::Window> mpMouseDownWin; //< last window, where MouseButtonDown() called
- ::std::vector<VclPtr<vcl::Window> > maOwnerDrawList; //< List of system windows with owner draw decoration
+ std::vector<VclPtr<vcl::Window> > maOwnerDrawList; //< List of system windows with owner draw decoration
PhysicalFontCollection* mpFontCollection; //< Font-List for this frame
- ImplFontCache* mpFontCache; //< Font-Cache for this frame
+ std::shared_ptr<ImplFontCache> mxFontCache; //< Font-Cache for this frame
sal_Int32 mnDPIX; //< Original Screen Resolution
sal_Int32 mnDPIY; //< Original Screen Resolution
ImplSVEvent * mnFocusId; //< FocusId for PostUserLink
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 432d6335db54..dcd049cd86b8 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -361,7 +361,7 @@ bool InitVCL()
// Initialize global data
pSVData->maGDIData.mpScreenFontList = new PhysicalFontCollection;
- pSVData->maGDIData.mpScreenFontCache = new ImplFontCache;
+ pSVData->maGDIData.mxScreenFontCache.reset(new ImplFontCache);
pSVData->maGDIData.mpGrfConverter = new GraphicConverter;
g_bIsLeanException = getenv("LO_LEAN_EXCEPTION") != nullptr;
@@ -617,8 +617,7 @@ void DeInitVCL()
delete pSVData->maGDIData.mpScreenFontList;
pSVData->maGDIData.mpScreenFontList = nullptr;
- delete pSVData->maGDIData.mpScreenFontCache;
- pSVData->maGDIData.mpScreenFontCache = nullptr;
+ pSVData->maGDIData.mxScreenFontCache.reset();
// Deinit Sal
if (pSVData->mpDefInst)
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index b11b453395c8..877c85e45315 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -678,7 +678,7 @@ void Printer::ImplInit( SalPrinterQueueInfo* pInfo )
// Init data
ImplUpdatePageData();
mpFontCollection = new PhysicalFontCollection();
- mpFontCache = new ImplFontCache();
+ mxFontCache.reset(new ImplFontCache);
mpGraphics->GetDevFontList( mpFontCollection );
}
@@ -692,7 +692,7 @@ void Printer::ImplInitDisplay()
mpDisplayDev = VclPtr<VirtualDevice>::Create();
mpFontCollection = pSVData->maGDIData.mpScreenFontList;
- mpFontCache = pSVData->maGDIData.mpScreenFontCache;
+ mxFontCache = pSVData->maGDIData.mxScreenFontCache;
mnDPIX = mpDisplayDev->mnDPIX;
mnDPIY = mpDisplayDev->mnDPIY;
}
@@ -936,8 +936,7 @@ void Printer::dispose()
mpFontInstance.clear();
mpDeviceFontList.reset();
mpDeviceFontSizeList.reset();
- delete mpFontCache;
- mpFontCache = nullptr;
+ mxFontCache.reset();
// font list deleted by OutputDevice dtor
}
@@ -1074,9 +1073,8 @@ bool Printer::SetPrinterProps( const Printer* pPrinter )
mpDeviceFontList.reset();
mpDeviceFontSizeList.reset();
// clean up font list
- delete mpFontCache;
+ mxFontCache.reset();
delete mpFontCollection;
- mpFontCache = nullptr;
mpFontCollection = nullptr;
mbInitFont = true;
@@ -1104,9 +1102,8 @@ bool Printer::SetPrinterProps( const Printer* pPrinter )
mpFontInstance.clear();
mpDeviceFontList.reset();
mpDeviceFontSizeList.reset();
- delete mpFontCache;
+ mxFontCache.reset();
delete mpFontCollection;
- mpFontCache = nullptr;
mpFontCollection = nullptr;
mbInitFont = true;
mbNewFont = true;
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 4f3b65b58ede..cecdfa53ef76 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -169,7 +169,7 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
meOutDevType = OUTDEV_VIRDEV;
mbDevOutput = true;
mpFontCollection = pSVData->maGDIData.mpScreenFontList;
- mpFontCache = pSVData->maGDIData.mpScreenFontCache;
+ mxFontCache = pSVData->maGDIData.mxScreenFontCache;
mnDPIX = pOutDev->mnDPIX;
mnDPIY = pOutDev->mnDPIY;
mnDPIScalePercentage = pOutDev->mnDPIScalePercentage;
@@ -496,15 +496,14 @@ void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32
ImplSVData* pSVData = ImplGetSVData();
if( mpFontCollection && (mpFontCollection != pSVData->maGDIData.mpScreenFontList) )
delete mpFontCollection;
- if( mpFontCache && (mpFontCache != pSVData->maGDIData.mpScreenFontCache) )
- delete mpFontCache;
+ mxFontCache.reset();
// get font list with scalable fonts only
AcquireGraphics();
mpFontCollection = pSVData->maGDIData.mpScreenFontList->Clone();
// prepare to use new font lists
- mpFontCache = new ImplFontCache();
+ mxFontCache.reset(new ImplFontCache);
}
sal_uInt16 VirtualDevice::GetBitCount() const
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index d41ba14a0414..f79c0a0493ee 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -531,8 +531,8 @@ void OutputDevice::ImplClearFontData( const bool bNewFontLists )
{
ImplSVData* pSVData = ImplGetSVData();
- if( mpFontCache && mpFontCache != pSVData->maGDIData.mpScreenFontCache )
- mpFontCache->Invalidate();
+ if (mxFontCache && mxFontCache != pSVData->maGDIData.mxScreenFontCache)
+ mxFontCache->Invalidate();
if ( bNewFontLists )
{
@@ -546,10 +546,8 @@ void OutputDevice::ImplClearFontData( const bool bNewFontLists )
{
if( mpFontCollection && mpFontCollection != pSVData->maGDIData.mpScreenFontList )
delete mpFontCollection;
- if( mpFontCache && mpFontCache != pSVData->maGDIData.mpScreenFontCache )
- delete mpFontCache;
+ mxFontCache.reset();
mpFontCollection = nullptr;
- mpFontCache = nullptr;
}
}
}
@@ -586,7 +584,7 @@ void OutputDevice::ImplRefreshFontData( const bool bNewFontLists )
if( mpPDFWriter )
{
mpFontCollection = pSVData->maGDIData.mpScreenFontList->Clone();
- mpFontCache = new ImplFontCache();
+ mxFontCache.reset(new ImplFontCache);
}
else
{
@@ -621,7 +619,7 @@ void OutputDevice::ImplClearAllFontData(bool bNewFontLists)
ImplUpdateFontDataForAllFrames( &OutputDevice::ImplClearFontData, bNewFontLists );
// clear global font lists to have them updated
- pSVData->maGDIData.mpScreenFontCache->Invalidate();
+ pSVData->maGDIData.mxScreenFontCache->Invalidate();
if ( bNewFontLists )
{
pSVData->maGDIData.mpScreenFontList->Clear();
@@ -917,7 +915,7 @@ vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLan
// get the name of the first available font
float fExactHeight = static_cast<float>(aSize.Height());
- rtl::Reference<LogicalFontInstance> pFontInstance = pOutDev->mpFontCache->GetFontInstance( pOutDev->mpFontCollection, aFont, aSize, fExactHeight );
+ rtl::Reference<LogicalFontInstance> pFontInstance = pOutDev->mxFontCache->GetFontInstance( pOutDev->mpFontCollection, aFont, aSize, fExactHeight );
if (pFontInstance)
{
assert(pFontInstance->GetFontFace());
@@ -1031,7 +1029,7 @@ bool OutputDevice::ImplNewFont() const
{
const ImplSVData* pSVData = ImplGetSVData();
if( mpFontCollection == pSVData->maGDIData.mpScreenFontList
- || mpFontCache == pSVData->maGDIData.mpScreenFontCache )
+ || mxFontCache == pSVData->maGDIData.mxScreenFontCache )
const_cast<OutputDevice&>(*this).ImplUpdateFontData();
}
@@ -1067,7 +1065,7 @@ bool OutputDevice::ImplNewFont() const
// get font entry
rtl::Reference<LogicalFontInstance> pOldFontInstance = mpFontInstance;
- mpFontInstance = mpFontCache->GetFontInstance( mpFontCollection, maFont, aSize, fExactHeight );
+ mpFontInstance = mxFontCache->GetFontInstance( mpFontCollection, maFont, aSize, fExactHeight );
bool bNewFontInstance = pOldFontInstance.get() != mpFontInstance.get();
pOldFontInstance.clear();
@@ -1382,7 +1380,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt
// if the system-specific glyph fallback is active
aFontSelData.mpFontInstance = mpFontInstance; // reset the fontinstance to base-level
- rtl::Reference<LogicalFontInstance> pFallbackFont = mpFontCache->GetGlyphFallbackFont( mpFontCollection,
+ rtl::Reference<LogicalFontInstance> pFallbackFont = mxFontCache->GetGlyphFallbackFont( mpFontCollection,
aFontSelData, nFallbackLevel, aMissingCodes );
if( !pFallbackFont )
break;
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 901b20580fdf..a251389990bd 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -58,7 +58,6 @@ OutputDevice::OutputDevice() :
mpNextGraphics = nullptr;
mpMetaFile = nullptr;
mpFontInstance = nullptr;
- mpFontCache = nullptr;
mpFontCollection = nullptr;
mpDeviceFontList = nullptr;
mpDeviceFontSizeList = nullptr;
@@ -179,14 +178,7 @@ void OutputDevice::dispose()
mpDeviceFontSizeList.reset();
// release ImplFontCache specific to this OutputDevice
- // TODO: refcount ImplFontCache
- if( mpFontCache
- && (mpFontCache != ImplGetSVData()->maGDIData.mpScreenFontCache)
- && (ImplGetSVData()->maGDIData.mpScreenFontCache != nullptr) )
- {
- delete mpFontCache;
- mpFontCache = nullptr;
- }
+ mxFontCache.reset();
// release ImplFontList specific to this OutputDevice
// TODO: refcount ImplFontList
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 08f61fe76f8f..91e772478013 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -779,7 +779,7 @@ ImplFrameData::ImplFrameData( vcl::Window *pWindow )
mpMouseMoveWin = nullptr;
mpMouseDownWin = nullptr;
mpFontCollection = pSVData->maGDIData.mpScreenFontList;
- mpFontCache = pSVData->maGDIData.mpScreenFontCache;
+ mxFontCache = pSVData->maGDIData.mxScreenFontCache;
mnFocusId = nullptr;
mnMouseMoveId = nullptr;
mnLastMouseX = -1;
@@ -1080,7 +1080,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p
// #99318: make sure fontcache and list is available before call to SetSettings
mpFontCollection = mpWindowImpl->mpFrameData->mpFontCollection;
- mpFontCache = mpWindowImpl->mpFrameData->mpFontCache;
+ mxFontCache = mpWindowImpl->mpFrameData->mxFontCache;
if ( mpWindowImpl->mbFrame )
{
@@ -1753,7 +1753,7 @@ void Window::ImplNewInputContext()
else
aSize.setHeight( (12*pFocusWin->mnDPIY)/72 );
}
- pFontInstance = pFocusWin->mpFontCache->GetFontInstance( pFocusWin->mpFontCollection,
+ pFontInstance = pFocusWin->mxFontCache->GetFontInstance( pFocusWin->mpFontCollection,
rFont, aSize, static_cast<float>(aSize.Height()) );
if ( pFontInstance )
aNewContext.mpFont = pFontInstance;
More information about the Libreoffice-commits
mailing list