Bug 1249312: UseAcceleratedCanvas on Mac should really be UseAcceleratedSkiaCanvas. r?mchang
MozReview-Commit-ID: GdiEdawGoDM
--- 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: