Honor the "gfx.color_management.force_srgb" when it is set as a default pref in addition to when it is set as a user pref. (Bug 608030) r=jrmuizel a2.0=blocking2.0:betaN+
authorL. David Baron <dbaron@dbaron.org>
Mon, 24 Jan 2011 16:23:07 -0800
changeset 61192 dfc9b86cea803b7396ec5d4c5d268d03c9a75319
parent 61191 ac6c96109dcf468c65912e6677ab8c5f638c7135
child 61193 9c1bea8d506b17ac12c96cf63d80cc7955cde29f
push id18272
push userdbaron@mozilla.com
push dateTue, 25 Jan 2011 00:23:22 +0000
treeherdermozilla-central@742bc2628690 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs608030
milestone2.0b10pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Honor the "gfx.color_management.force_srgb" when it is set as a default pref in addition to when it is set as a user pref. (Bug 608030) r=jrmuizel a2.0=blocking2.0:betaN+
gfx/thebes/gfxPlatform.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -958,24 +958,26 @@ gfxPlatform::GetCMSOutputProfile()
         NS_TIME_FUNCTION;
 
         nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
         if (prefs) {
 
             nsresult rv;
 
             /* Determine if we're using the internal override to force sRGB as
-               an output profile for reftests. See Bug 452125. */
-            PRBool hasSRGBOverride, doSRGBOverride;
-            rv = prefs->PrefHasUserValue(CMForceSRGBPrefName, &hasSRGBOverride);
-            if (NS_SUCCEEDED(rv) && hasSRGBOverride) {
-                rv = prefs->GetBoolPref(CMForceSRGBPrefName, &doSRGBOverride);
-                if (NS_SUCCEEDED(rv) && doSRGBOverride)
-                    gCMSOutputProfile = GetCMSsRGBProfile();
-            }
+               an output profile for reftests. See Bug 452125.
+
+               Note that we don't normally (outside of tests) set a
+               default value of this preference, which means GetBoolPref
+               will typically throw (and leave its out-param untouched).
+             */
+            PRBool doSRGBOverride;
+            rv = prefs->GetBoolPref(CMForceSRGBPrefName, &doSRGBOverride);
+            if (NS_SUCCEEDED(rv) && doSRGBOverride)
+                gCMSOutputProfile = GetCMSsRGBProfile();
 
             if (!gCMSOutputProfile) {
 
                 nsXPIDLCString fname;
                 rv = prefs->GetCharPref(CMProfilePrefName,
                                         getter_Copies(fname));
                 if (NS_SUCCEEDED(rv) && !fname.IsEmpty()) {
                     gCMSOutputProfile = qcms_profile_from_path(fname);