Bug 1348584 Default to 1.0 contrast for Skia backends if custom contrast dwrite param isn't supported by skia. r=emk a=gchang
authorMason Chang <mchang@mozilla.com>
Wed, 22 Mar 2017 22:04:00 -0700
changeset 379219 62c0bc2f6c9c169e5c3ca5678edf17ce8a9c4a3f
parent 379218 cf5e46f441ce33c8db7df6a38459304fac47fb42
child 379220 80c1aeac2957d9c3ffe74f8af40c5364354c062b
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk, gchang
bugs1348584
milestone53.0
Bug 1348584 Default to 1.0 contrast for Skia backends if custom contrast dwrite param isn't supported by skia. r=emk a=gchang
gfx/thebes/gfxWindowsPlatform.cpp
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -1250,16 +1250,24 @@ gfxWindowsPlatform::SetupClearTypeParams
                 RegCloseKey(hKey);
             }
 
             if (contrast < 0.0 || contrast > 10.0) {
                 contrast = 1.0;
             }
         }
 
+        if (GetDefaultContentBackend() == BackendType::SKIA) {
+          // Skia doesn't support a contrast value outside of 0-1, so default to 1.0
+          if (contrast < 0.0 || contrast > 1.0) {
+            NS_WARNING("Custom dwrite contrast not supported in Skia. Defaulting to 1.0.");
+            contrast = 1.0;
+          }
+        }
+
         // For parameters that have not been explicitly set,
         // we copy values from default params (or our overridden value for contrast)
         if (gamma < 1.0 || gamma > 2.2) {
             gamma = defaultRenderingParams->GetGamma();
         }
 
         if (level < 0.0 || level > 1.0) {
             level = defaultRenderingParams->GetClearTypeLevel();