Bug 1249312: UseAcceleratedCanvas on Mac should really be UseAcceleratedSkiaCanvas. r?mchang draft
authorMilan Sreckovic <milan@mozilla.com>
Thu, 18 Feb 2016 14:00:53 -0500
changeset 331914 e896e928ca37b7b1c6da4230f940e50b4ef9fe4b
parent 331857 fcd35e10fa17d9fd11d92be48ae9698c2a900f1c
child 514499 c8020e677e48fe116e62167a25587e17fedbcb88
push id11114
push usermsreckovic@mozilla.com
push dateThu, 18 Feb 2016 19:01:08 +0000
reviewersmchang
bugs1249312
milestone47.0a1
Bug 1249312: UseAcceleratedCanvas on Mac should really be UseAcceleratedSkiaCanvas. r?mchang MozReview-Commit-ID: GdiEdawGoDM
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/composite/LayerManagerComposite.h
gfx/thebes/gfxPlatformMac.cpp
gfx/thebes/gfxPlatformMac.h
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -1451,36 +1451,16 @@ LayerManagerComposite::AutoAddMaskEffect
 {
   if (!mCompositable) {
     return;
   }
 
   mCompositable->RemoveMaskEffect();
 }
 
-already_AddRefed<DrawTarget>
-LayerManagerComposite::CreateDrawTarget(const IntSize &aSize,
-                                        SurfaceFormat aFormat)
-{
-#ifdef XP_MACOSX
-  // We don't want to accelerate if the surface is too small which indicates
-  // that it's likely used for an icon/static image. We also don't want to
-  // accelerate anything that is above the maximum texture size of weakest gpu.
-  // Safari uses 5000 area as the minimum for acceleration, we decided 64^2 is more logical.
-  bool useAcceleration = aSize.width <= 4096 && aSize.height <= 4096 &&
-                         aSize.width > 64 && aSize.height > 64 &&
-                         gfxPlatformMac::GetPlatform()->UseAcceleratedCanvas();
-  if (useAcceleration) {
-    return Factory::CreateDrawTarget(BackendType::COREGRAPHICS_ACCELERATED,
-                                     aSize, aFormat);
-  }
-#endif
-  return LayerManager::CreateDrawTarget(aSize, aFormat);
-}
-
 LayerComposite::LayerComposite(LayerManagerComposite *aManager)
   : mCompositeManager(aManager)
   , mCompositor(aManager->GetCompositor())
   , mShadowOpacity(1.0)
   , mShadowTransformSetByAnimation(false)
   , mDestroyed(false)
   , mLayerComposited(false)
 { }
--- a/gfx/layers/composite/LayerManagerComposite.h
+++ b/gfx/layers/composite/LayerManagerComposite.h
@@ -199,24 +199,16 @@ public:
 
     bool Failed() const { return mFailed; }
   private:
     CompositableHost* mCompositable;
     bool mFailed;
   };
 
   /**
-   * Creates a DrawTarget which is optimized for inter-operating with this
-   * layermanager.
-   */
-  virtual already_AddRefed<mozilla::gfx::DrawTarget>
-    CreateDrawTarget(const mozilla::gfx::IntSize& aSize,
-                     mozilla::gfx::SurfaceFormat aFormat) override;
-
-  /**
    * Calculates the 'completeness' of the rendering that intersected with the
    * screen on the last render. This is only useful when progressive tile
    * drawing is enabled, otherwise this will always return 1.0.
    * This function's expense scales with the size of the layer tree and the
    * complexity of individual layers' valid regions.
    */
   float ComputeRenderIntegrity();
 
--- a/gfx/thebes/gfxPlatformMac.cpp
+++ b/gfx/thebes/gfxPlatformMac.cpp
@@ -422,20 +422,20 @@ gfxPlatformMac::ReadAntiAliasingThreshol
         }
         CFRelease(prefValue);
     }
 
     return threshold;
 }
 
 bool
-gfxPlatformMac::UseAcceleratedCanvas()
+gfxPlatformMac::UseAcceleratedSkiaCanvas()
 {
   // Lion or later is required
-  return nsCocoaFeatures::OnLionOrLater() && Preferences::GetBool("gfx.canvas.azure.accelerated", false);
+  return nsCocoaFeatures::OnLionOrLater() && gfxPlatform::UseAcceleratedSkiaCanvas();
 }
 
 bool
 gfxPlatformMac::UseProgressivePaint()
 {
   // Progressive painting requires cross-process mutexes, which don't work so
   // well on OS X 10.6 so we disable there.
   return nsCocoaFeatures::OnLionOrLater() && gfxPlatform::UseProgressivePaint();
--- a/gfx/thebes/gfxPlatformMac.h
+++ b/gfx/thebes/gfxPlatformMac.h
@@ -85,17 +85,17 @@ public:
 
     bool RequiresAcceleratedGLContextForCompositorOGL() const override {
       // On OS X in a VM, unaccelerated CompositorOGL shows black flashes, so we
       // require accelerated GL for CompositorOGL but allow unaccelerated GL for
       // BasicCompositor.
       return true;
     }
 
-    bool UseAcceleratedCanvas();
+    virtual bool UseAcceleratedSkiaCanvas() override;
 
     virtual bool UseProgressivePaint() override;
     virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
 
     // lower threshold on font anti-aliasing
     uint32_t GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; }
 
 protected: