[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source vcl/win
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Aug 20 13:21:06 UTC 2018
include/vcl/outdev.hxx | 2 +-
vcl/inc/svdata.hxx | 2 +-
vcl/inc/window.h | 2 +-
vcl/source/app/svmain.cxx | 5 ++---
vcl/source/gdi/print.cxx | 12 +++++-------
vcl/source/gdi/virdev.cxx | 7 +++----
vcl/source/outdev/font.cxx | 42 ++++++++++++++++++++----------------------
vcl/source/outdev/outdev.cxx | 11 +----------
vcl/source/window/window.cxx | 8 ++++----
vcl/win/gdi/salfont.cxx | 2 +-
10 files changed, 39 insertions(+), 54 deletions(-)
New commits:
commit d9ab7be6c2e4494846081b089710f4dd0b1d2ad3
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Aug 19 21:17:52 2018 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Aug 20 15:20:45 2018 +0200
TODO: refcount ImplFontList
Change-Id: Ie125f1ac9c14a41e25c3e54beafca2f9e34e4c6f
Reviewed-on: https://gerrit.libreoffice.org/59310
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 28dab9a0df9c..ff37b971b344 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -340,7 +340,7 @@ private:
GDIMetaFile* mpMetaFile;
mutable rtl::Reference<LogicalFontInstance> mpFontInstance;
mutable std::shared_ptr<ImplFontCache> mxFontCache;
- mutable PhysicalFontCollection* mpFontCollection;
+ mutable std::shared_ptr<PhysicalFontCollection> mxFontCollection;
mutable std::unique_ptr<ImplDeviceFontList> mpDeviceFontList;
mutable std::unique_ptr<ImplDeviceFontSizeList> mpDeviceFontSizeList;
std::unique_ptr<OutDevStateStack> mpOutDevStateStack;
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 7b35a0283e93..52980ec3260b 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -184,7 +184,7 @@ struct ImplSVGDIData
VclPtr<Printer> mpFirstPrinter; // First Printer
VclPtr<Printer> mpLastPrinter; // Last Printer
ImplPrnQueueList* mpPrinterQueueList = nullptr; // List of all printer queue
- PhysicalFontCollection* mpScreenFontList = nullptr; // Screen-Font-List
+ std::shared_ptr<PhysicalFontCollection> mxScreenFontList; // Screen-Font-List
std::shared_ptr<ImplFontCache> mxScreenFontCache; // Screen-Font-Cache
ImplDirectFontSubstitution* mpDirectFontSubst = nullptr; // Font-Substitutions defined in Tools->Options->Fonts
GraphicConverter* mpGrfConverter = nullptr; // Converter for graphics
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index f1a5f66ef830..21448efd9496 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -128,7 +128,7 @@ struct ImplFrameData
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
- PhysicalFontCollection* mpFontCollection; //< Font-List for this frame
+ std::shared_ptr<PhysicalFontCollection> mxFontCollection; //< Font-List 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
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index dcd049cd86b8..a91b5c6686db 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -360,7 +360,7 @@ bool InitVCL()
pSVData->maAppData.mpAppFileName = new OUString( aNativeFileName );
// Initialize global data
- pSVData->maGDIData.mpScreenFontList = new PhysicalFontCollection;
+ pSVData->maGDIData.mxScreenFontList.reset(new PhysicalFontCollection);
pSVData->maGDIData.mxScreenFontCache.reset(new ImplFontCache);
pSVData->maGDIData.mpGrfConverter = new GraphicConverter;
@@ -615,8 +615,7 @@ void DeInitVCL()
pSVData->maWinData.mpAutoScrollWin = nullptr;
pSVData->maWinData.mpLastWheelWindow = nullptr;
- delete pSVData->maGDIData.mpScreenFontList;
- pSVData->maGDIData.mpScreenFontList = nullptr;
+ pSVData->maGDIData.mxScreenFontList.reset();
pSVData->maGDIData.mxScreenFontCache.reset();
// Deinit Sal
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 877c85e45315..4f62d062f8a2 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -677,9 +677,9 @@ void Printer::ImplInit( SalPrinterQueueInfo* pInfo )
// Init data
ImplUpdatePageData();
- mpFontCollection = new PhysicalFontCollection();
+ mxFontCollection.reset(new PhysicalFontCollection);
mxFontCache.reset(new ImplFontCache);
- mpGraphics->GetDevFontList( mpFontCollection );
+ mpGraphics->GetDevFontList(mxFontCollection.get());
}
void Printer::ImplInitDisplay()
@@ -691,7 +691,7 @@ void Printer::ImplInitDisplay()
mpJobGraphics = nullptr;
mpDisplayDev = VclPtr<VirtualDevice>::Create();
- mpFontCollection = pSVData->maGDIData.mpScreenFontList;
+ mxFontCollection = pSVData->maGDIData.mxScreenFontList;
mxFontCache = pSVData->maGDIData.mxScreenFontCache;
mnDPIX = mpDisplayDev->mnDPIX;
mnDPIY = mpDisplayDev->mnDPIY;
@@ -1074,8 +1074,7 @@ bool Printer::SetPrinterProps( const Printer* pPrinter )
mpDeviceFontSizeList.reset();
// clean up font list
mxFontCache.reset();
- delete mpFontCollection;
- mpFontCollection = nullptr;
+ mxFontCollection.reset();
mbInitFont = true;
mbNewFont = true;
@@ -1103,8 +1102,7 @@ bool Printer::SetPrinterProps( const Printer* pPrinter )
mpDeviceFontList.reset();
mpDeviceFontSizeList.reset();
mxFontCache.reset();
- delete mpFontCollection;
- mpFontCollection = nullptr;
+ mxFontCollection.reset();
mbInitFont = true;
mbNewFont = true;
mpInfoPrinter = nullptr;
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index cecdfa53ef76..f48d9b3b1473 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -168,7 +168,7 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
meOutDevType = OUTDEV_VIRDEV;
mbDevOutput = true;
- mpFontCollection = pSVData->maGDIData.mpScreenFontList;
+ mxFontCollection = pSVData->maGDIData.mxScreenFontList;
mxFontCache = pSVData->maGDIData.mxScreenFontCache;
mnDPIX = pOutDev->mnDPIX;
mnDPIY = pOutDev->mnDPIY;
@@ -494,13 +494,12 @@ void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32
// preserve global font lists
ImplSVData* pSVData = ImplGetSVData();
- if( mpFontCollection && (mpFontCollection != pSVData->maGDIData.mpScreenFontList) )
- delete mpFontCollection;
+ mxFontCollection.reset();
mxFontCache.reset();
// get font list with scalable fonts only
AcquireGraphics();
- mpFontCollection = pSVData->maGDIData.mpScreenFontList->Clone();
+ mxFontCollection.reset(pSVData->maGDIData.mxScreenFontList->Clone());
// prepare to use new font lists
mxFontCache.reset(new ImplFontCache);
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index f79c0a0493ee..81a825fe17f8 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -69,12 +69,12 @@ int OutputDevice::GetDevFontCount() const
{
if( !mpDeviceFontList )
{
- if (!mpFontCollection)
+ if (!mxFontCollection)
{
return 0;
}
- mpDeviceFontList = mpFontCollection->GetDeviceFontList();
+ mpDeviceFontList = mxFontCollection->GetDeviceFontList();
if (!mpDeviceFontList->Count())
{
@@ -87,7 +87,7 @@ int OutputDevice::GetDevFontCount() const
bool OutputDevice::IsFontAvailable( const OUString& rFontName ) const
{
- PhysicalFontFamily* pFound = mpFontCollection->FindFontFamily( rFontName );
+ PhysicalFontFamily* pFound = mxFontCollection->FindFontFamily( rFontName );
return (pFound != nullptr);
}
@@ -96,7 +96,7 @@ int OutputDevice::GetDevFontSizeCount( const vcl::Font& rFont ) const
mpDeviceFontSizeList.reset();
ImplInitFontList();
- mpDeviceFontSizeList = mpFontCollection->GetDeviceFontSizeList( rFont.GetFamilyName() );
+ mpDeviceFontSizeList = mxFontCollection->GetDeviceFontSizeList( rFont.GetFamilyName() );
return mpDeviceFontSizeList->Count();
}
@@ -155,7 +155,7 @@ bool OutputDevice::AddTempDevFont( const OUString& rFileURL, const OUString& rFo
if( !mpGraphics && !AcquireGraphics() )
return false;
- bool bRC = mpGraphics->AddTempDevFont( mpFontCollection, rFileURL, rFontName );
+ bool bRC = mpGraphics->AddTempDevFont( mxFontCollection.get(), rFileURL, rFontName );
if( !bRC )
return false;
@@ -539,15 +539,13 @@ void OutputDevice::ImplClearFontData( const bool bNewFontLists )
// we need a graphics
if ( AcquireGraphics() )
{
- if( mpFontCollection && mpFontCollection != pSVData->maGDIData.mpScreenFontList )
- mpFontCollection->Clear();
+ if (mxFontCollection && mxFontCollection != pSVData->maGDIData.mxScreenFontList)
+ mxFontCollection->Clear();
if( mpPDFWriter )
{
- if( mpFontCollection && mpFontCollection != pSVData->maGDIData.mpScreenFontList )
- delete mpFontCollection;
+ mxFontCollection.reset();
mxFontCache.reset();
- mpFontCollection = nullptr;
}
}
}
@@ -583,12 +581,12 @@ void OutputDevice::ImplRefreshFontData( const bool bNewFontLists )
{
if( mpPDFWriter )
{
- mpFontCollection = pSVData->maGDIData.mpScreenFontList->Clone();
+ mxFontCollection.reset(pSVData->maGDIData.mxScreenFontList->Clone());
mxFontCache.reset(new ImplFontCache);
}
else
{
- mpGraphics->GetDevFontList( mpFontCollection );
+ mpGraphics->GetDevFontList( mxFontCollection.get() );
}
}
}
@@ -622,7 +620,7 @@ void OutputDevice::ImplClearAllFontData(bool bNewFontLists)
pSVData->maGDIData.mxScreenFontCache->Invalidate();
if ( bNewFontLists )
{
- pSVData->maGDIData.mpScreenFontList->Clear();
+ pSVData->maGDIData.mxScreenFontList->Clear();
vcl::Window * pFrame = pSVData->maWinData.mpFirstFrame;
if ( pFrame )
{
@@ -630,7 +628,7 @@ void OutputDevice::ImplClearAllFontData(bool bNewFontLists)
{
OutputDevice *pDevice = pFrame;
pDevice->mpGraphics->ClearDevFontCache();
- pDevice->mpGraphics->GetDevFontList(pFrame->mpWindowImpl->mpFrameData->mpFontCollection);
+ pDevice->mpGraphics->GetDevFontList(pFrame->mpWindowImpl->mpFrameData->mxFontCollection.get());
}
}
}
@@ -869,7 +867,7 @@ vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLan
sal_Int32 nIndex = 0;
do
{
- PhysicalFontFamily* pFontFamily = pOutDev->mpFontCollection->FindFontFamily( GetNextFontToken( aSearch, nIndex ) );
+ PhysicalFontFamily* pFontFamily = pOutDev->mxFontCollection->FindFontFamily( GetNextFontToken( aSearch, nIndex ) );
if( pFontFamily )
{
AddTokenFontName( aName, pFontFamily->GetFamilyName() );
@@ -915,7 +913,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->mxFontCache->GetFontInstance( pOutDev->mpFontCollection, aFont, aSize, fExactHeight );
+ rtl::Reference<LogicalFontInstance> pFontInstance = pOutDev->mxFontCache->GetFontInstance( pOutDev->mxFontCollection.get(), aFont, aSize, fExactHeight );
if (pFontInstance)
{
assert(pFontInstance->GetFontFace());
@@ -974,15 +972,15 @@ vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLan
void OutputDevice::ImplInitFontList() const
{
- if( !mpFontCollection->Count() )
+ if( !mxFontCollection->Count() )
{
if( mpGraphics || AcquireGraphics() )
{
SAL_INFO( "vcl.gdi", "OutputDevice::ImplInitFontList()" );
- mpGraphics->GetDevFontList( mpFontCollection );
+ mpGraphics->GetDevFontList(mxFontCollection.get());
// There is absolutely no way there should be no fonts available on the device
- if( !mpFontCollection->Count() )
+ if( !mxFontCollection->Count() )
{
OUString aError( "Application error: no fonts and no vcl resource found on your system" );
OUString aResStr(VclResId(SV_ACCESSERROR_NO_FONTS));
@@ -1028,7 +1026,7 @@ bool OutputDevice::ImplNewFont() const
if( mpPDFWriter )
{
const ImplSVData* pSVData = ImplGetSVData();
- if( mpFontCollection == pSVData->maGDIData.mpScreenFontList
+ if( mxFontCollection == pSVData->maGDIData.mxScreenFontList
|| mxFontCache == pSVData->maGDIData.mxScreenFontCache )
const_cast<OutputDevice&>(*this).ImplUpdateFontData();
}
@@ -1065,7 +1063,7 @@ bool OutputDevice::ImplNewFont() const
// get font entry
rtl::Reference<LogicalFontInstance> pOldFontInstance = mpFontInstance;
- mpFontInstance = mxFontCache->GetFontInstance( mpFontCollection, maFont, aSize, fExactHeight );
+ mpFontInstance = mxFontCache->GetFontInstance( mxFontCollection.get(), maFont, aSize, fExactHeight );
bool bNewFontInstance = pOldFontInstance.get() != mpFontInstance.get();
pOldFontInstance.clear();
@@ -1380,7 +1378,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 = mxFontCache->GetGlyphFallbackFont( mpFontCollection,
+ rtl::Reference<LogicalFontInstance> pFallbackFont = mxFontCache->GetGlyphFallbackFont( mxFontCollection.get(),
aFontSelData, nFallbackLevel, aMissingCodes );
if( !pFallbackFont )
break;
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index a251389990bd..340c0a68f495 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;
- mpFontCollection = nullptr;
mpDeviceFontList = nullptr;
mpDeviceFontSizeList = nullptr;
mpOutDevStateStack.reset(new OutDevStateStack);
@@ -181,15 +180,7 @@ void OutputDevice::dispose()
mxFontCache.reset();
// release ImplFontList specific to this OutputDevice
- // TODO: refcount ImplFontList
- if( mpFontCollection
- && (mpFontCollection != ImplGetSVData()->maGDIData.mpScreenFontList)
- && (ImplGetSVData()->maGDIData.mpScreenFontList != nullptr) )
- {
- mpFontCollection->Clear();
- delete mpFontCollection;
- mpFontCollection = nullptr;
- }
+ mxFontCollection.reset();
mpAlphaVDev.disposeAndClear();
mpPrevGraphics.clear();
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 91e772478013..243d30a93beb 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -778,7 +778,7 @@ ImplFrameData::ImplFrameData( vcl::Window *pWindow )
mpFocusWin = nullptr;
mpMouseMoveWin = nullptr;
mpMouseDownWin = nullptr;
- mpFontCollection = pSVData->maGDIData.mpScreenFontList;
+ mxFontCollection = pSVData->maGDIData.mxScreenFontList;
mxFontCache = pSVData->maGDIData.mxScreenFontCache;
mnFocusId = nullptr;
mnMouseMoveId = nullptr;
@@ -1079,8 +1079,8 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p
mpWindowImpl->mpRealParent = pRealParent;
// #99318: make sure fontcache and list is available before call to SetSettings
- mpFontCollection = mpWindowImpl->mpFrameData->mpFontCollection;
- mxFontCache = mpWindowImpl->mpFrameData->mxFontCache;
+ mxFontCollection = mpWindowImpl->mpFrameData->mxFontCollection;
+ mxFontCache = mpWindowImpl->mpFrameData->mxFontCache;
if ( mpWindowImpl->mbFrame )
{
@@ -1753,7 +1753,7 @@ void Window::ImplNewInputContext()
else
aSize.setHeight( (12*pFocusWin->mnDPIY)/72 );
}
- pFontInstance = pFocusWin->mxFontCache->GetFontInstance( pFocusWin->mpFontCollection,
+ pFontInstance = pFocusWin->mxFontCache->GetFontInstance( pFocusWin->mxFontCollection.get(),
rFont, aSize, static_cast<float>(aSize.Height()) );
if ( pFontInstance )
aNewContext.mpFont = pFontInstance;
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 61f76dd74608..7ea455715136 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -288,7 +288,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFon
// first level fallback:
// try use the locale specific default fonts defined in VCL.xcu
- const PhysicalFontCollection* pFontCollection = ImplGetSVData()->maGDIData.mpScreenFontList;
+ const PhysicalFontCollection* pFontCollection = ImplGetSVData()->maGDIData.mxScreenFontList.get();
PhysicalFontFamily* pFontFamily = findDevFontListByLocale(*pFontCollection, aLanguageTag);
if( pFontFamily )
{
More information about the Libreoffice-commits
mailing list