mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 11:26:09 +00:00
Bug 747377 - Force D2D on in Metro mode. r=bas
This commit is contained in:
parent
ba908b4d16
commit
365c621abf
@ -391,6 +391,36 @@ gfxWindowsPlatform::~gfxWindowsPlatform()
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
gfxWindowsPlatform::IsRunningInWindows8Metro()
|
||||
{
|
||||
static bool alreadyChecked = false;
|
||||
static bool isMetro = false;
|
||||
if (alreadyChecked) {
|
||||
return isMetro;
|
||||
}
|
||||
|
||||
HMODULE user32DLL = LoadLibraryW(L"user32.dll");
|
||||
if (!user32DLL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef BOOL (WINAPI* IsImmersiveProcessFunc)(HANDLE process);
|
||||
IsImmersiveProcessFunc IsImmersiveProcessPtr =
|
||||
(IsImmersiveProcessFunc)GetProcAddress(user32DLL,
|
||||
"IsImmersiveProcess");
|
||||
FreeLibrary(user32DLL);
|
||||
if (!IsImmersiveProcessPtr) {
|
||||
// isMetro is already set to false.
|
||||
alreadyChecked = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
isMetro = IsImmersiveProcessPtr(GetCurrentProcess());
|
||||
alreadyChecked = true;
|
||||
return isMetro;
|
||||
}
|
||||
|
||||
void
|
||||
gfxWindowsPlatform::UpdateRenderMode()
|
||||
{
|
||||
@ -429,8 +459,11 @@ gfxWindowsPlatform::UpdateRenderMode()
|
||||
d2dDisabled = Preferences::GetBool("gfx.direct2d.disabled", false);
|
||||
d2dForceEnabled = Preferences::GetBool("gfx.direct2d.force-enabled", false);
|
||||
|
||||
// In Metro mode there is no fallback available
|
||||
d2dForceEnabled |= IsRunningInWindows8Metro();
|
||||
|
||||
bool tryD2D = !d2dBlocked || d2dForceEnabled;
|
||||
|
||||
|
||||
// Do not ever try if d2d is explicitly disabled,
|
||||
// or if we're not using DWrite fonts.
|
||||
if (d2dDisabled || mUsingGDIFonts) {
|
||||
|
@ -241,6 +241,7 @@ public:
|
||||
#endif
|
||||
|
||||
static bool IsOptimus();
|
||||
static bool IsRunningInWindows8Metro();
|
||||
|
||||
protected:
|
||||
RenderMode mRenderMode;
|
||||
|
Loading…
Reference in New Issue
Block a user