diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-05 13:15:42 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-05 23:13:15 +0200 |
commit | 515d2579d305a6127c6c194319a58eac62437e33 (patch) | |
tree | e283e99d3ed36c2f3a954df976604c7fea8d29fe /vcl/win | |
parent | edd163b5e148d1c71ff2c3f55455c971513a6f62 (diff) |
Replace legacy dynamically-loaded functions with statically linked ones
We don't need the dynamic load complexity for these now with baseline
Windows version being Windows 7 SP1. Stuff used only for compatibility
with older versions was dumped.
Change-Id: I810f271796cfd875cfa18a3081c9ad444fe57b3e
Reviewed-on: https://gerrit.libreoffice.org/70321
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/gdi/DWriteTextRenderer.cxx | 39 | ||||
-rw-r--r-- | vcl/win/gdi/winlayout.cxx | 9 | ||||
-rw-r--r-- | vcl/win/window/salframe.cxx | 40 |
3 files changed, 18 insertions, 70 deletions
diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index 6dbfdbf403c3..117b35989b1c 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -32,43 +32,6 @@ #include <comphelper/windowserrorstring.hxx> #include <sal/log.hxx> -HINSTANCE D2DWriteTextOutRenderer::mmD2d1 = nullptr, - D2DWriteTextOutRenderer::mmDWrite = nullptr; -D2DWriteTextOutRenderer::pD2D1CreateFactory_t D2DWriteTextOutRenderer::D2D1CreateFactory = nullptr; -D2DWriteTextOutRenderer::pDWriteCreateFactory_t D2DWriteTextOutRenderer::DWriteCreateFactory = nullptr; - -bool D2DWriteTextOutRenderer::InitModules() -{ - mmD2d1 = LoadLibraryW(L"D2d1.dll"); - mmDWrite = LoadLibraryW(L"dwrite.dll"); - if (mmD2d1 && mmDWrite) - { - D2D1CreateFactory = pD2D1CreateFactory_t(GetProcAddress(mmD2d1, "D2D1CreateFactory")); - DWriteCreateFactory = pDWriteCreateFactory_t(GetProcAddress(mmDWrite, "DWriteCreateFactory")); - } - - if (!D2D1CreateFactory || !DWriteCreateFactory) - { - CleanupModules(); - return false; - } - - return true; -} - -void D2DWriteTextOutRenderer::CleanupModules() -{ - if (mmD2d1) - FreeLibrary(mmD2d1); - if (mmDWrite) - FreeLibrary(mmDWrite); - - mmD2d1 = nullptr; - mmDWrite = nullptr; - D2D1CreateFactory = nullptr; - DWriteCreateFactory = nullptr; -} - namespace { @@ -167,8 +130,6 @@ D2DWriteTextOutRenderer::~D2DWriteTextOutRenderer() mpDWriteFactory->Release(); if (mpD2DFactory) mpD2DFactory->Release(); - - CleanupModules(); } void D2DWriteTextOutRenderer::applyTextAntiAliasMode() diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 9be60fcac64e..797ce2eb8ffc 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -210,16 +210,11 @@ TextOutRenderer & TextOutRenderer::get(bool bUseDWrite) if (bUseDWrite) { - static bool const bSuccess(D2DWriteTextOutRenderer::InitModules()); - if (bSuccess && !pSalData->m_pD2DWriteTextOutRenderer) + if (!pSalData->m_pD2DWriteTextOutRenderer) { pSalData->m_pD2DWriteTextOutRenderer.reset(new D2DWriteTextOutRenderer()); } - if (pSalData->m_pD2DWriteTextOutRenderer) - { - return *pSalData->m_pD2DWriteTextOutRenderer; - } - // else: fall back to GDI + return *pSalData->m_pD2DWriteTextOutRenderer; } if (!pSalData->m_pExTextOutRenderer) { diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 64d505de56ff..16cdf0e8579f 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -1794,34 +1794,26 @@ void WinSalFrame::SetApplicationID( const OUString &rApplicationID ) // http://msdn.microsoft.com/en-us/library/windows/desktop/dd378430(v=vs.85).aspx // A window's properties must be removed before the window is closed. - typedef HRESULT ( WINAPI *SHGETPROPERTYSTOREFORWINDOW )( HWND, REFIID, void ** ); - SHGETPROPERTYSTOREFORWINDOW pSHGetPropertyStoreForWindow; - pSHGetPropertyStoreForWindow = reinterpret_cast<SHGETPROPERTYSTOREFORWINDOW>(GetProcAddress( - GetModuleHandleW (L"shell32.dll"), "SHGetPropertyStoreForWindow" )); - - if( pSHGetPropertyStoreForWindow ) + IPropertyStore *pps; + HRESULT hr = SHGetPropertyStoreForWindow(mhWnd, IID_PPV_ARGS(&pps)); + if (SUCCEEDED(hr)) { - IPropertyStore *pps; - HRESULT hr = pSHGetPropertyStoreForWindow ( mhWnd, IID_PPV_ARGS(&pps) ); - if ( SUCCEEDED(hr) ) + PROPVARIANT pv; + if (!rApplicationID.isEmpty()) { - PROPVARIANT pv; - if ( !rApplicationID.isEmpty() ) - { - hr = InitPropVariantFromString( o3tl::toW(rApplicationID.getStr()), &pv ); - mbPropertiesStored = true; - } - else - // if rApplicationID we remove the property from the window, if present - PropVariantInit( &pv ); + hr = InitPropVariantFromString(o3tl::toW(rApplicationID.getStr()), &pv); + mbPropertiesStored = true; + } + else + // if rApplicationID we remove the property from the window, if present + PropVariantInit(&pv); - if ( SUCCEEDED(hr) ) - { - hr = pps->SetValue( PKEY_AppUserModel_ID, pv ); - PropVariantClear( &pv ); - } - pps->Release(); + if (SUCCEEDED(hr)) + { + hr = pps->SetValue(PKEY_AppUserModel_ID, pv); + PropVariantClear(&pv); } + pps->Release(); } } |