Bug 1260770: Only clear the DWrite factory if we didn't have one to begin with. r=milan, a=lizzard
authorBas Schouten <bschouten@mozilla.com>
Tue, 12 Apr 2016 12:54:00 +0200
changeset 319621 40538c2ee09d3ed4f851fecc200676fb6fe18258
parent 319620 ba6b68e8b767d3b0347bc0cc77d626131989d60a
child 319622 aa2e334e6635cb24c89cfa20a0639c706be4625f
push id1079
push userjlund@mozilla.com
push dateFri, 15 Apr 2016 21:02:33 +0000
treeherdermozilla-release@575fbf6786d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan, lizzard
bugs1260770
milestone46.0
Bug 1260770: Only clear the DWrite factory if we didn't have one to begin with. r=milan, a=lizzard MozReview-Commit-ID: GhCqfbOqqz5
gfx/thebes/gfxWindowsPlatform.cpp
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -2646,26 +2646,33 @@ gfxWindowsPlatform::InitializeD2D()
   // Initialize D2D 1.1.
   InitializeD2D1();
 
   if (mD2DStatus == FeatureStatus::Failed) {
     // Do not init dwrite if d2d failed.
     return;
   }
 
+  // If we're getting here after we've already started using DWrite, we never
+  // want to go back to GDI fonts. However if we don't have anything yet, we
+  // should go to GDI if D2D 1.0 device creation fails.
+  bool hadDWriteFactory = !!mDWriteFactory;
+
     // Using Direct2D depends on DWrite support.
   if (!mDWriteFactory && !InitDWriteSupport()) {
     mD2DStatus = FeatureStatus::Failed;
     return;
   }
 
   // Initialize D2D 1.0.
   VerifyD2DDevice(gfxPrefs::Direct2DForceEnabled());
   if (!mD3D10Device) {
-    mDWriteFactory = nullptr;
+    if (!hadDWriteFactory) {
+      mDWriteFactory = nullptr;
+    }
     mD2DStatus = FeatureStatus::Failed;
     return;
   }
 
   mD2DStatus = FeatureStatus::Available;
 }
 
 FeatureStatus