Backed out changeset d34dd7156b4d

This commit is contained in:
John Daggett 2011-05-09 15:19:33 +09:00
Родитель 9476a3a424
Коммит 0a81d96dc0
11 изменённых файлов: 10 добавлений и 218 удалений

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

@ -785,97 +785,6 @@ gfxWindowsPlatform::GetDLLVersion(const PRUnichar *aDLLPath, nsAString& aVersion
aVersion.Assign(NS_ConvertUTF8toUTF16(buf));
}
void
gfxWindowsPlatform::GetCleartypeParams(nsTArray<ClearTypeParameterInfo>& aParams)
{
HKEY hKey, subKey;
DWORD i, rv, size, type;
WCHAR displayName[256], subkeyName[256];
aParams.Clear();
// construct subkeys based on HKLM subkeys, assume they are same for HKCU
rv = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"Software\\Microsoft\\Avalon.Graphics",
0, KEY_READ, &hKey);
if (rv != ERROR_SUCCESS) {
return;
}
// enumerate over subkeys
for (i = 0, rv = ERROR_SUCCESS; rv != ERROR_NO_MORE_ITEMS; i++) {
size = NS_ARRAY_LENGTH(displayName);
rv = RegEnumKeyExW(hKey, i, displayName, &size, NULL, NULL, NULL, NULL);
if (rv != ERROR_SUCCESS) {
continue;
}
ClearTypeParameterInfo ctinfo;
ctinfo.displayName.Assign(displayName);
DWORD subrv, value;
bool foundData = false;
swprintf_s(subkeyName, NS_ARRAY_LENGTH(subkeyName),
L"Software\\Microsoft\\Avalon.Graphics\\%s", displayName);
// subkey for gamma, pixel structure
subrv = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
subkeyName, 0, KEY_QUERY_VALUE, &subKey);
if (subrv == ERROR_SUCCESS) {
size = sizeof(value);
subrv = RegQueryValueExW(subKey, L"GammaLevel", NULL, &type,
(LPBYTE)&value, &size);
if (subrv == ERROR_SUCCESS && type == REG_DWORD) {
foundData = true;
ctinfo.gamma = value;
}
size = sizeof(value);
subrv = RegQueryValueExW(subKey, L"PixelStructure", NULL, &type,
(LPBYTE)&value, &size);
if (subrv == ERROR_SUCCESS && type == REG_DWORD) {
foundData = true;
ctinfo.pixelStructure = value;
}
RegCloseKey(subKey);
}
// subkey for cleartype level, enhanced contrast
subrv = RegOpenKeyExW(HKEY_CURRENT_USER,
subkeyName, 0, KEY_QUERY_VALUE, &subKey);
if (subrv == ERROR_SUCCESS) {
size = sizeof(value);
subrv = RegQueryValueExW(subKey, L"ClearTypeLevel", NULL, &type,
(LPBYTE)&value, &size);
if (subrv == ERROR_SUCCESS && type == REG_DWORD) {
foundData = true;
ctinfo.clearTypeLevel = value;
}
size = sizeof(value);
subrv = RegQueryValueExW(subKey, L"EnhancedContrastLevel",
NULL, &type, (LPBYTE)&value, &size);
if (subrv == ERROR_SUCCESS && type == REG_DWORD) {
foundData = true;
ctinfo.enhancedContrast = value;
}
RegCloseKey(subKey);
}
if (foundData) {
aParams.AppendElement(ctinfo);
}
}
RegCloseKey(hKey);
}
void
gfxWindowsPlatform::FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref)
{
@ -921,19 +830,19 @@ gfxWindowsPlatform::SetupClearTypeParams(nsIPrefBranch *aPrefBranch)
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_GAMMA,
&value))) {
if (value >= 1000 && value <= 2200) {
gamma = FLOAT(value / 1000.0);
gamma = (FLOAT)value / 1000.0;
}
}
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_CONTRAST,
&value))) {
if (value >= 0 && value <= 1000) {
contrast = FLOAT(value / 100.0);
contrast = (FLOAT)value / 100.0;
}
}
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_LEVEL,
&value))) {
if (value >= 0 && value <= 100) {
level = FLOAT(value / 100.0);
level = (FLOAT)value / 100.0;
}
}
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_STRUCTURE,

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

@ -114,19 +114,6 @@ struct DCFromContext {
PRBool needsRelease;
};
// ClearType parameters set by running ClearType tuner
struct ClearTypeParameterInfo {
ClearTypeParameterInfo() :
gamma(-1), pixelStructure(-1), clearTypeLevel(-1), enhancedContrast(-1)
{ }
nsString displayName; // typically just 'DISPLAY1'
PRInt32 gamma;
PRInt32 pixelStructure;
PRInt32 clearTypeLevel;
PRInt32 enhancedContrast;
};
class THEBES_API gfxWindowsPlatform : public gfxPlatform {
public:
gfxWindowsPlatform();
@ -249,9 +236,6 @@ public:
static void GetDLLVersion(const PRUnichar *aDLLPath, nsAString& aVersion);
// returns ClearType tuning information for each display
static void GetCleartypeParams(nsTArray<ClearTypeParameterInfo>& aParams);
virtual void FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref);
void SetupClearTypeParams(nsIPrefBranch *aPrefBranch);

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

@ -259,17 +259,11 @@ function populateGraphicsSection() {
try {
dwEnabled = gfxInfo.DWriteEnabled + " (" + gfxInfo.DWriteVersion + ")";
} catch(e) {}
pushInfoRow(trGraphics, "directWriteEnabled", dwEnabled);
var cleartypeParams = "";
try {
cleartypeParams = gfxInfo.cleartypeParameters;
} catch(e) {
cleartypeParams = bundle.GetStringFromName("clearTypeParametersNotFound");
}
pushInfoRow(trGraphics, "clearTypeParameters", cleartypeParams);
trGraphics.push(createParentElement("tr", [
createHeader(bundle.GetStringFromName("directWriteEnabled")),
createElement("td", dwEnabled),
]));
}
#endif
var webglrenderer;

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

@ -1,6 +1,5 @@
# LOCALIZATION NOTE In the following strings, "Direct2D", "DirectWrite" and "ClearType"
# are proper nouns and should not be translated. Feel free to leave english strings if
# there are no good translations, these are only used in about:support
# LOCALIZATION NOTE In the following string, "Direct2D" is a proper noun and should not be translated.
# Feel free to leave english strings if there are no good translations, these are only used in about:support
# LOCALIZATION NOTE: This can be localized with a more generic term, like
# "Graphics-accelerated Windows". It describes a number of windows, e.g.:
@ -22,8 +21,6 @@ blockedOSVersion = Blocked for your operating system version.
direct2DEnabled = Direct2D Enabled
directWriteEnabled = DirectWrite Enabled
clearTypeParameters = ClearType Parameters
clearTypeParametersNotFound = ClearType parameters not found
adapterDescription = Adapter Description
adapterVendorID = Vendor ID
adapterDeviceID = Device ID

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

@ -40,7 +40,7 @@
/* NOTE: this interface is completely undesigned, not stable and likely to change */
[scriptable, uuid(a67c77af-2952-4028-93ab-e7bc3b43cf81)]
[scriptable, uuid(5c5de1e7-f7f4-46b4-9ced-03ab1f869eaf)]
interface nsIGfxInfo : nsISupports
{
/*
@ -49,7 +49,6 @@ interface nsIGfxInfo : nsISupports
readonly attribute boolean D2DEnabled;
readonly attribute boolean DWriteEnabled;
readonly attribute DOMString DWriteVersion;
readonly attribute DOMString cleartypeParameters;
/**
* The name of the display adapter.

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

@ -73,13 +73,6 @@ GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString cleartypeParameters; */
NS_IMETHODIMP
GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams)
{
return NS_ERROR_FAILURE;
}
nsresult
GfxInfo::Init()
{

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

@ -55,7 +55,6 @@ public:
NS_SCRIPTABLE NS_IMETHOD GetD2DEnabled(PRBool *aD2DEnabled);
NS_SCRIPTABLE NS_IMETHOD GetDWriteEnabled(PRBool *aDWriteEnabled);
NS_SCRIPTABLE NS_IMETHOD GetDWriteVersion(nsAString & aDwriteVersion);
NS_SCRIPTABLE NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID(PRUint32 *aAdapterVendorID);

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

@ -55,7 +55,6 @@ public:
NS_SCRIPTABLE NS_IMETHOD GetD2DEnabled(PRBool *aD2DEnabled);
NS_SCRIPTABLE NS_IMETHOD GetDWriteEnabled(PRBool *aDWriteEnabled);
NS_SCRIPTABLE NS_IMETHOD GetDWriteVersion(nsAString & aDwriteVersion);
NS_SCRIPTABLE NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID(PRUint32 *aAdapterVendorID);

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

@ -114,13 +114,6 @@ GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString cleartypeParameters; */
NS_IMETHODIMP
GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterDescription; */
NS_IMETHODIMP
GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)

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

@ -106,80 +106,6 @@ GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
return NS_OK;
}
#define PIXEL_STRUCT_RGB 1
#define PIXEL_STRUCT_BGR 2
/* readonly attribute DOMString cleartypeParameters; */
NS_IMETHODIMP
GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams)
{
nsTArray<ClearTypeParameterInfo> clearTypeParams;
gfxWindowsPlatform::GetPlatform()->GetCleartypeParams(clearTypeParams);
PRUint32 d, numDisplays = clearTypeParams.Length();
bool displayNames = (numDisplays > 1);
bool foundData = false;
nsString outStr;
WCHAR valStr[256];
for (d = 0; d < numDisplays; d++) {
ClearTypeParameterInfo& params = clearTypeParams[d];
if (displayNames) {
swprintf_s(valStr, NS_ARRAY_LENGTH(valStr),
L"%s [ ", params.displayName.get());
outStr.Append(valStr);
}
if (params.gamma >= 0) {
foundData = true;
swprintf_s(valStr, NS_ARRAY_LENGTH(valStr),
L"Gamma: %d ", params.gamma);
outStr.Append(valStr);
}
if (params.pixelStructure >= 0) {
foundData = true;
if (params.pixelStructure == PIXEL_STRUCT_RGB ||
params.pixelStructure == PIXEL_STRUCT_BGR)
{
swprintf_s(valStr, NS_ARRAY_LENGTH(valStr),
L"Pixel Structure: %s ",
(params.pixelStructure == PIXEL_STRUCT_RGB ?
L"RGB" : L"BGR"));
} else {
swprintf_s(valStr, NS_ARRAY_LENGTH(valStr),
L"Pixel Structure: %d ", params.pixelStructure);
}
outStr.Append(valStr);
}
if (params.clearTypeLevel >= 0) {
foundData = true;
swprintf_s(valStr, NS_ARRAY_LENGTH(valStr),
L"ClearType Level: %d ", params.clearTypeLevel);
outStr.Append(valStr);
}
if (params.enhancedContrast >= 0) {
foundData = true;
swprintf_s(valStr, NS_ARRAY_LENGTH(valStr),
L"Enhanced Contrast: %d ", params.enhancedContrast);
outStr.Append(valStr);
}
if (displayNames) {
outStr.Append(L"] ");
}
}
if (foundData) {
aCleartypeParams.Assign(outStr);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
/* XXX: GfxInfo doesn't handle multiple GPUs. We should try to do that. Bug #591057 */
static nsresult GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, nsAString& destString, int type)

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

@ -59,7 +59,6 @@ public:
NS_SCRIPTABLE NS_IMETHOD GetD2DEnabled(PRBool *aD2DEnabled);
NS_SCRIPTABLE NS_IMETHOD GetDWriteEnabled(PRBool *aDWriteEnabled);
NS_SCRIPTABLE NS_IMETHOD GetDWriteVersion(nsAString & aDwriteVersion);
NS_SCRIPTABLE NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID(PRUint32 *aAdapterVendorID);