Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Unified Diff: core/src/fxge/win32/fx_win32_device.cpp

Issue 1748163006: Don't load GDI+ if GDI is disabled. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/win32/fx_win32_device.cpp
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index 58f8769ac75014e2fadc39c059c4ee2b31d04c0f..44fbd4c399273798b3600036719c003f709c2f49 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -438,14 +438,20 @@ FX_BOOL CFX_Win32FontInfo::GetFontCharset(void* hFont, int& charset) {
charset = tm.tmCharSet;
return TRUE;
}
-IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) {
+static FX_BOOL IsGDIEnabled() {
+ // If GDI is disabled then GetDC for the desktop will fail.
HDC hdc = ::GetDC(NULL);
if (hdc) {
::ReleaseDC(NULL, hdc);
+ return TRUE;
+ }
+ return FALSE;
+}
+IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) {
+ if (IsGDIEnabled()) {
return new CFX_Win32FontInfo;
}
- // If GDI is disabled then GetDC for the desktop will fail. Select the
- // fallback font information class if GDI is disabled.
+ // Select the fallback font information class if GDI is disabled.
CFX_Win32FallbackFontInfo* pInfoFallback = new CFX_Win32FallbackFontInfo;
// Construct the font path manually, SHGetKnownFolderPath won't work under
// a restrictive sandbox.
@@ -464,7 +470,9 @@ void CFX_GEModule::InitPlatform() {
ver.dwOSVersionInfoSize = sizeof(ver);
GetVersionEx(&ver);
pPlatformData->m_bHalfTone = ver.dwMajorVersion >= 5;
- pPlatformData->m_GdiplusExt.Load();
+ if (IsGDIEnabled()) {
+ pPlatformData->m_GdiplusExt.Load();
+ }
m_pPlatformData = pPlatformData;
m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault(nullptr));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698