Backed out changeset 18183f6ef0d8 (bug 910860) for xpcshell and reftest failures.

This commit is contained in:
Ryan VanderMeulen 2014-02-21 12:35:35 -05:00
parent 36321accbc
commit 0fceb198fa
3 changed files with 24 additions and 28 deletions

View File

@ -104,9 +104,7 @@ static qcms_transform *gCMSRGBATransform = nullptr;
static bool gCMSInitialized = false;
static eCMSMode gCMSMode = eCMSMode_Off;
static bool gCMSIntentInitialized = false;
static int gCMSIntent = QCMS_INTENT_DEFAULT;
static int gCMSIntent = -2;
static void ShutdownCMS();
static void MigratePrefs();
@ -143,9 +141,11 @@ NS_IMPL_ISUPPORTS2(SRGBOverrideObserver, nsIObserver, nsISupportsWeakReference)
#define BIDI_NUMERAL_PREF "bidi.numeral"
#define GFX_PREF_CMS_RENDERING_INTENT "gfx.color_management.rendering_intent"
#define GFX_PREF_CMS_DISPLAY_PROFILE "gfx.color_management.display_profile"
#define GFX_PREF_CMS_ENABLED_OBSOLETE "gfx.color_management.enabled"
#define GFX_PREF_CMS_FORCE_SRGB "gfx.color_management.force_srgb"
#define GFX_PREF_CMS_ENABLEV4 "gfx.color_management.enablev4"
#define GFX_PREF_CMS_MODE "gfx.color_management.mode"
NS_IMETHODIMP
@ -1621,14 +1621,17 @@ gfxPlatform::GetCMSMode()
{
if (gCMSInitialized == false) {
gCMSInitialized = true;
nsresult rv;
int32_t mode = gfxPrefs::CMSMode();
if (mode >= 0 && mode < eCMSMode_AllCount) {
int32_t mode;
rv = Preferences::GetInt(GFX_PREF_CMS_MODE, &mode);
if (NS_SUCCEEDED(rv) && (mode >= 0) && (mode < eCMSMode_AllCount)) {
gCMSMode = static_cast<eCMSMode>(mode);
}
bool enableV4 = gfxPrefs::CMSEnableV4();
if (enableV4) {
bool enableV4;
rv = Preferences::GetBool(GFX_PREF_CMS_ENABLEV4, &enableV4);
if (NS_SUCCEEDED(rv) && enableV4) {
qcms_enable_iccv4();
}
}
@ -1638,22 +1641,23 @@ gfxPlatform::GetCMSMode()
int
gfxPlatform::GetRenderingIntent()
{
if (!gCMSIntentInitialized) {
gCMSIntentInitialized = true;
// gfxPrefs.h is using 0 as the default for the rendering
// intent preference, based on that being the value for
// QCMS_INTENT_DEFAULT. Assert here to catch if that ever
// changes and we can then figure out what to do about it.
MOZ_ASSERT(QCMS_INTENT_DEFAULT == 0);
if (gCMSIntent == -2) {
/* Try to query the pref system for a rendering intent. */
int32_t pIntent = gfxPrefs::CMSRenderingIntent();
if ((pIntent >= QCMS_INTENT_MIN) && (pIntent <= QCMS_INTENT_MAX)) {
gCMSIntent = pIntent;
} else {
int32_t pIntent;
if (NS_SUCCEEDED(Preferences::GetInt(GFX_PREF_CMS_RENDERING_INTENT, &pIntent))) {
/* If the pref is within range, use it as an override. */
if ((pIntent >= QCMS_INTENT_MIN) && (pIntent <= QCMS_INTENT_MAX)) {
gCMSIntent = pIntent;
}
/* If the pref is out of range, use embedded profile. */
gCMSIntent = -1;
else {
gCMSIntent = -1;
}
}
/* If we didn't get a valid intent from prefs, use the default. */
else {
gCMSIntent = QCMS_INTENT_DEFAULT;
}
}
return gCMSIntent;

View File

@ -103,11 +103,6 @@ public:
// We will keep these in an alphabetical order to make it easier to see if
// a method accessing a pref already exists. Just add yours in the list.
DECL_GFX_PREFS(Live, "gfx.color_management.enablev4", CMSEnableV4, bool, false);
DECL_GFX_PREFS(Live, "gfx.color_management.mode", CMSMode, int32_t,-1);
// The zero default here should match QCMS_INTENT_DEFAULT from qcms.h
DECL_GFX_PREFS(Live, "gfx.color_management.rendering_intent", CMSRenderingIntent, int32_t, 0);
public:
// Manage the singleton:
static gfxPrefs& One()

View File

@ -300,9 +300,6 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType)
mUserFontSet = nullptr;
mUserFontSetDirty = true;
// We need to initialize gfxPlatform if it hasn't been already.
gfxPlatform::GetPlatform();
// if text perf logging enabled, init stats struct
PRLogModuleInfo *log = gfxPlatform::GetLog(eGfxLog_textperf);
if (log && PR_LOG_TEST(log, PR_LOG_WARNING)) {