Bug 630201. Don't use DirectWrite for pre-RTM versions of Windows 7. r=bas, a=joedrew

This commit is contained in:
John Daggett 2011-02-25 10:31:16 +09:00
Родитель 38a12eeaea
Коммит 723aae06e9
2 изменённых файлов: 34 добавлений и 3 удалений

Просмотреть файл

@ -408,6 +408,29 @@ gfxWindowsPlatform::VerifyD2DDevice(PRBool aAttemptForce)
#endif #endif
} }
// bug 630201 - older pre-RTM versions of Direct2D/DirectWrite cause odd
// crashers so blacklist them altogether
#ifdef CAIRO_HAS_DWRITE_FONT
#define WINDOWS7_RTM_BUILD 7600
static PRBool
AllowDirectWrite()
{
PRInt32 winVers, buildNum;
winVers = gfxWindowsPlatform::WindowsOSVersion(&buildNum);
if (winVers == gfxWindowsPlatform::kWindows7 &&
buildNum < WINDOWS7_RTM_BUILD)
{
// don't use Direct2D/DirectWrite on older versions of Windows 7
return PR_FALSE;
}
return PR_TRUE;
}
#endif
gfxPlatformFontList* gfxPlatformFontList*
gfxWindowsPlatform::CreatePlatformFontList() gfxWindowsPlatform::CreatePlatformFontList()
{ {
@ -417,7 +440,7 @@ gfxWindowsPlatform::CreatePlatformFontList()
pfl = new gfxFT2FontList(); pfl = new gfxFT2FontList();
#else #else
#ifdef CAIRO_HAS_DWRITE_FONT #ifdef CAIRO_HAS_DWRITE_FONT
if (GetDWriteFactory()) { if (AllowDirectWrite() && GetDWriteFactory()) {
pfl = new gfxDWriteFontList(); pfl = new gfxDWriteFontList();
if (NS_SUCCEEDED(pfl->InitFontList())) { if (NS_SUCCEEDED(pfl->InitFontList())) {
return pfl; return pfl;
@ -677,9 +700,10 @@ gfxWindowsPlatform::UseClearTypeAlways()
} }
PRInt32 PRInt32
gfxWindowsPlatform::WindowsOSVersion() gfxWindowsPlatform::WindowsOSVersion(PRInt32 *aBuildNum)
{ {
static PRInt32 winVersion = UNINITIALIZED_VALUE; static PRInt32 winVersion = UNINITIALIZED_VALUE;
static PRInt32 buildNum = UNINITIALIZED_VALUE;
OSVERSIONINFO vinfo; OSVERSIONINFO vinfo;
@ -687,10 +711,17 @@ gfxWindowsPlatform::WindowsOSVersion()
vinfo.dwOSVersionInfoSize = sizeof (vinfo); vinfo.dwOSVersionInfoSize = sizeof (vinfo);
if (!GetVersionEx(&vinfo)) { if (!GetVersionEx(&vinfo)) {
winVersion = kWindowsUnknown; winVersion = kWindowsUnknown;
buildNum = 0;
} else { } else {
winVersion = PRInt32(vinfo.dwMajorVersion << 16) + vinfo.dwMinorVersion; winVersion = PRInt32(vinfo.dwMajorVersion << 16) + vinfo.dwMinorVersion;
buildNum = PRInt32(vinfo.dwBuildNumber);
} }
} }
if (aBuildNum) {
*aBuildNum = buildNum;
}
return winVersion; return winVersion;
} }

Просмотреть файл

@ -232,7 +232,7 @@ public:
kWindows7 = 0x60001 kWindows7 = 0x60001
}; };
static PRInt32 WindowsOSVersion(); static PRInt32 WindowsOSVersion(PRInt32 *aBuildNum = nsnull);
static void GetDLLVersion(const PRUnichar *aDLLPath, nsAString& aVersion); static void GetDLLVersion(const PRUnichar *aDLLPath, nsAString& aVersion);