Bug 793085 - Remove UseAzureContentDrawing() in favour of SupportsAzureContent(). r=ncameron
authorAnthony Jones <ajones@mozilla.com>
Mon, 01 Oct 2012 22:12:13 -0400
changeset 108961 aab010487a73b86c9f740802b719a19b1dd2e25f
parent 108960 932204a65b9c0edb9dfd940172280890423d7926
child 108962 aa73f5544e07d0ad205db239251812e3a1423e17
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersncameron
bugs793085
milestone18.0a1
Bug 793085 - Remove UseAzureContentDrawing() in favour of SupportsAzureContent(). r=ncameron
gfx/layers/d3d10/ThebesLayerD3D10.cpp
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
--- a/gfx/layers/d3d10/ThebesLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ThebesLayerD3D10.cpp
@@ -398,17 +398,17 @@ ThebesLayerD3D10::DrawRegion(nsIntRegion
   if (!mD2DSurface && !mDrawTarget) {
     return;
   }
 
   nsRefPtr<gfxASurface> destinationSurface;
   
   if (aMode == SURFACE_COMPONENT_ALPHA) {
     FillTexturesBlackWhite(aRegion, visibleRect.TopLeft());
-    if (!gfxPlatform::UseAzureContentDrawing()) {
+    if (!gfxPlatform::GetPlatform()->SupportsAzureContent()) {
       gfxASurface* surfaces[2] = { mD2DSurface.get(), mD2DSurfaceOnWhite.get() };
       destinationSurface = new gfxTeeSurface(surfaces, ArrayLength(surfaces));
       // Using this surface as a source will likely go horribly wrong, since
       // only the onBlack surface will really be used, so alpha information will
       // be incorrect.
       destinationSurface->SetAllowUseAsSource(false);
     }
   } else {
@@ -472,17 +472,17 @@ ThebesLayerD3D10::CreateNewTextures(cons
     }
 
     hr = device()->CreateShaderResourceView(mTexture, NULL, getter_AddRefs(mSRView));
 
     if (FAILED(hr)) {
       NS_WARNING("Failed to create shader resource view for ThebesLayerD3D10.");
     }
 
-    if (!gfxPlatform::UseAzureContentDrawing()) {
+    if (!gfxPlatform::GetPlatform()->SupportsAzureContent()) {
       mD2DSurface = new gfxD2DSurface(mTexture, aMode != SURFACE_SINGLE_CHANNEL_ALPHA ?
                                                 gfxASurface::CONTENT_COLOR : gfxASurface::CONTENT_COLOR_ALPHA);
 
       if (!mD2DSurface || mD2DSurface->CairoStatus()) {
         NS_WARNING("Failed to create surface for ThebesLayerD3D10.");
         mD2DSurface = NULL;
         return;
       }
@@ -500,30 +500,30 @@ ThebesLayerD3D10::CreateNewTextures(cons
     }
 
     hr = device()->CreateShaderResourceView(mTextureOnWhite, NULL, getter_AddRefs(mSRViewOnWhite));
 
     if (FAILED(hr)) {
       NS_WARNING("Failed to create shader resource view for ThebesLayerD3D10.");
     }
 
-    if (!gfxPlatform::UseAzureContentDrawing()) {
+    if (!gfxPlatform::GetPlatform()->SupportsAzureContent()) {
       mD2DSurfaceOnWhite = new gfxD2DSurface(mTextureOnWhite, gfxASurface::CONTENT_COLOR);
 
       if (!mD2DSurfaceOnWhite || mD2DSurfaceOnWhite->CairoStatus()) {
         NS_WARNING("Failed to create surface for ThebesLayerD3D10.");
         mD2DSurfaceOnWhite = nullptr;
         return;
       }
     } else {
       mDrawTarget = nullptr;
     }
   }
 
-  if (gfxPlatform::UseAzureContentDrawing() && !mDrawTarget) {
+  if (gfxPlatform::GetPlatform()->SupportsAzureContent() && !mDrawTarget) {
     if (aMode == SURFACE_COMPONENT_ALPHA) {
       mDrawTarget = Factory::CreateDualDrawTargetForD3D10Textures(mTexture, mTextureOnWhite, FORMAT_B8G8R8X8);
     } else {
       mDrawTarget = Factory::CreateDrawTargetForD3D10Texture(mTexture, aMode != SURFACE_SINGLE_CHANNEL_ALPHA ?
         FORMAT_B8G8R8X8 : FORMAT_B8G8R8A8);
     }
 
     if (!mDrawTarget) {
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -1244,31 +1244,16 @@ gfxPlatform::UseProgressiveTilePainting(
                                               "layers.progressive-paint",
                                               false);
     }
 
     return sUseProgressiveTilePainting;
 }
 
 bool
-gfxPlatform::UseAzureContentDrawing()
-{
-  static bool sAzureContentDrawingEnabled;
-  static bool sAzureContentDrawingPrefCached = false;
-
-  if (!sAzureContentDrawingPrefCached) {
-    sAzureContentDrawingPrefCached = true;
-    mozilla::Preferences::AddBoolVarCache(&sAzureContentDrawingEnabled,
-                                          "gfx.content.azure.enabled");
-  }
-
-  return sAzureContentDrawingEnabled;
-}
-
-bool
 gfxPlatform::OffMainThreadCompositingEnabled()
 {
   return XRE_GetProcessType() == GeckoProcessType_Default ?
     CompositorParent::CompositorLoop() != nullptr :
     CompositorChild::ChildProcessHasCompositor();
 }
 
 eCMSMode
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -375,19 +375,16 @@ public:
                                         nsTArray<const char*>& /*aFontList*/)
     {
         // platform-specific override, by default do nothing
     }
 
     // Break large OMTC tiled thebes layer painting into small paints.
     static bool UseProgressiveTilePainting();
 
-    // helper method to indicate if we want to use Azure content drawing
-    static bool UseAzureContentDrawing();
-
     static bool OffMainThreadCompositingEnabled();
 
     /**
      * Are we going to try color management?
      */
     static eCMSMode GetCMSMode();
 
     /**