aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r--win32/PlatWin.cxx48
1 files changed, 22 insertions, 26 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 2206c026e..f09cdfcf1 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -81,7 +81,7 @@ bool LoadD2D() {
static bool triedLoadingD2D = false;
if (!triedLoadingD2D) {
DWORD loadLibraryFlags = 0;
- HMODULE kernel32 = ::GetModuleHandle(TEXT("kernel32.dll"));
+ HMODULE kernel32 = ::GetModuleHandleW(L"kernel32.dll");
if (kernel32) {
if (::GetProcAddress(kernel32, "SetDefaultDllDirectories")) {
// Availability of SetDefaultDllDirectories implies Windows 8+ or
@@ -97,34 +97,30 @@ bool LoadD2D() {
IUnknown **factory);
hDLLD2D = ::LoadLibraryEx(TEXT("D2D1.DLL"), 0, loadLibraryFlags);
- if (hDLLD2D) {
- D2D1CFSig fnD2DCF = reinterpret_cast<D2D1CFSig>(::GetProcAddress(hDLLD2D, "D2D1CreateFactory"));
- if (fnD2DCF) {
- // A single threaded factory as Scintilla always draw on the GUI thread
- fnD2DCF(D2D1_FACTORY_TYPE_SINGLE_THREADED,
- __uuidof(ID2D1Factory),
- nullptr,
- reinterpret_cast<IUnknown**>(&pD2DFactory));
- }
+ D2D1CFSig fnD2DCF = DLLFunction<D2D1CFSig>(hDLLD2D, "D2D1CreateFactory");
+ if (fnD2DCF) {
+ // A single threaded factory as Scintilla always draw on the GUI thread
+ fnD2DCF(D2D1_FACTORY_TYPE_SINGLE_THREADED,
+ __uuidof(ID2D1Factory),
+ nullptr,
+ reinterpret_cast<IUnknown**>(&pD2DFactory));
}
hDLLDWrite = ::LoadLibraryEx(TEXT("DWRITE.DLL"), 0, loadLibraryFlags);
- if (hDLLDWrite) {
- DWriteCFSig fnDWCF = reinterpret_cast<DWriteCFSig>(::GetProcAddress(hDLLDWrite, "DWriteCreateFactory"));
- if (fnDWCF) {
- const GUID IID_IDWriteFactory2 = // 0439fc60-ca44-4994-8dee-3a9af7b732ec
- { 0x0439fc60, 0xca44, 0x4994, { 0x8d, 0xee, 0x3a, 0x9a, 0xf7, 0xb7, 0x32, 0xec } };
-
- const HRESULT hr = fnDWCF(DWRITE_FACTORY_TYPE_SHARED,
- IID_IDWriteFactory2,
+ DWriteCFSig fnDWCF = DLLFunction<DWriteCFSig>(hDLLDWrite, "DWriteCreateFactory");
+ if (fnDWCF) {
+ const GUID IID_IDWriteFactory2 = // 0439fc60-ca44-4994-8dee-3a9af7b732ec
+ { 0x0439fc60, 0xca44, 0x4994, { 0x8d, 0xee, 0x3a, 0x9a, 0xf7, 0xb7, 0x32, 0xec } };
+
+ const HRESULT hr = fnDWCF(DWRITE_FACTORY_TYPE_SHARED,
+ IID_IDWriteFactory2,
+ reinterpret_cast<IUnknown**>(&pIDWriteFactory));
+ if (SUCCEEDED(hr)) {
+ // D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT
+ d2dDrawTextOptions = static_cast<D2D1_DRAW_TEXT_OPTIONS>(0x00000004);
+ } else {
+ fnDWCF(DWRITE_FACTORY_TYPE_SHARED,
+ __uuidof(IDWriteFactory),
reinterpret_cast<IUnknown**>(&pIDWriteFactory));
- if (SUCCEEDED(hr)) {
- // D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT
- d2dDrawTextOptions = static_cast<D2D1_DRAW_TEXT_OPTIONS>(0x00000004);
- } else {
- fnDWCF(DWRITE_FACTORY_TYPE_SHARED,
- __uuidof(IDWriteFactory),
- reinterpret_cast<IUnknown**>(&pIDWriteFactory));
- }
}
}