Fix potential crash trying to use Direct2D 1.0. (bug 1249126, r=bas, a=lhenry)
authorDavid Anderson <danderson@mozilla.com>
Mon, 07 Mar 2016 00:10:34 -0800
changeset 337974 259032c2660ac93e0dad6302532d9bc314b67029
parent 337973 26a13c91cf415dd076f0d661783c87290fb3b396
child 337975 2b633069af6c966dc3689f1e726e84993bbec22c
push id12404
push userjlund@mozilla.com
push dateTue, 08 Mar 2016 02:54:16 +0000
reviewersbas, lhenry
bugs1249126
milestone46.0a2
Fix potential crash trying to use Direct2D 1.0. (bug 1249126, r=bas, a=lhenry)
gfx/thebes/gfxWindowsPlatform.cpp
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -520,27 +520,26 @@ gfxWindowsPlatform::HandleDeviceReset()
 static const BackendType SOFTWARE_BACKEND = BackendType::CAIRO;
 
 void
 gfxWindowsPlatform::UpdateBackendPrefs()
 {
   uint32_t canvasMask = BackendTypeBit(SOFTWARE_BACKEND);
   uint32_t contentMask = BackendTypeBit(SOFTWARE_BACKEND);
   BackendType defaultBackend = SOFTWARE_BACKEND;
-  if (GetD2DStatus() == FeatureStatus::Available) {
+  if (GetD2D1Status() == FeatureStatus::Available) {
+    contentMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
+    canvasMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
+    defaultBackend = BackendType::DIRECT2D1_1;
     mRenderMode = RENDER_DIRECT2D;
+  } else if (GetD2DStatus() == FeatureStatus::Available && gfxPrefs::Direct2DAllow1_0()) {
     canvasMask |= BackendTypeBit(BackendType::DIRECT2D);
     contentMask |= BackendTypeBit(BackendType::DIRECT2D);
-    if (GetD2D1Status() == FeatureStatus::Available) {
-      contentMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
-      canvasMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
-      defaultBackend = BackendType::DIRECT2D1_1;
-    } else {
-      defaultBackend = BackendType::DIRECT2D;
-    }
+    defaultBackend = BackendType::DIRECT2D;
+    mRenderMode = RENDER_DIRECT2D;
   } else {
     mRenderMode = RENDER_GDI;
     canvasMask |= BackendTypeBit(BackendType::SKIA);
   }
   contentMask |= BackendTypeBit(BackendType::SKIA);
   InitBackendPrefs(canvasMask, defaultBackend, contentMask, defaultBackend);
 }