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 | |
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')
-rw-r--r-- | vcl/Library_vclplug_win.mk | 2 | ||||
-rw-r--r-- | vcl/inc/win/DWriteTextRenderer.hxx | 14 | ||||
-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 |
5 files changed, 20 insertions, 84 deletions
diff --git a/vcl/Library_vclplug_win.mk b/vcl/Library_vclplug_win.mk index 24f2d2491342..f64cc0392d13 100644 --- a/vcl/Library_vclplug_win.mk +++ b/vcl/Library_vclplug_win.mk @@ -82,6 +82,8 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_win,\ )) $(eval $(call gb_Library_use_system_win32_libs,vclplug_win,\ + d2d1 \ + dwrite \ gdi32 \ gdiplus \ imm32 \ diff --git a/vcl/inc/win/DWriteTextRenderer.hxx b/vcl/inc/win/DWriteTextRenderer.hxx index 0e81b67167d1..92e0825bb8b3 100644 --- a/vcl/inc/win/DWriteTextRenderer.hxx +++ b/vcl/inc/win/DWriteTextRenderer.hxx @@ -36,19 +36,7 @@ enum class D2DTextAntiAliasMode class D2DWriteTextOutRenderer : public TextOutRenderer { - typedef HRESULT(WINAPI *pD2D1CreateFactory_t)(D2D1_FACTORY_TYPE, - REFIID, const D2D1_FACTORY_OPTIONS *, void **); - - typedef HRESULT(WINAPI *pDWriteCreateFactory_t)(DWRITE_FACTORY_TYPE, - REFIID, IUnknown **); - - static HINSTANCE mmD2d1, mmDWrite; - static pD2D1CreateFactory_t D2D1CreateFactory; - static pDWriteCreateFactory_t DWriteCreateFactory; - public: - static bool InitModules(); - explicit D2DWriteTextOutRenderer(); virtual ~D2DWriteTextOutRenderer() override; @@ -74,8 +62,6 @@ public: void changeTextAntiAliasMode(D2DTextAntiAliasMode eMode); private: - static void CleanupModules(); - // This is a singleton object disable copy ctor and assignment operator D2DWriteTextOutRenderer(const D2DWriteTextOutRenderer &) = delete; D2DWriteTextOutRenderer & operator = (const D2DWriteTextOutRenderer &) = delete; 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(); } } |