From 1c7b3ca99956ea2d42efbd405a9cc830114dde45 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 29 Apr 2016 19:20:41 -0400 Subject: [PATCH] Change Compositor::GetWidget to return a CompositorWidgetProxy. (bug 1264545 part 3, r=jimm) --- gfx/layers/Compositor.h | 2 +- gfx/layers/composite/LayerManagerComposite.cpp | 11 ++++++----- gfx/layers/opengl/CompositingRenderTargetOGL.cpp | 2 +- gfx/layers/opengl/CompositorOGL.cpp | 2 +- widget/nsIWidget.h | 16 ---------------- 5 files changed, 9 insertions(+), 24 deletions(-) diff --git a/gfx/layers/Compositor.h b/gfx/layers/Compositor.h index 562fadc7d14b..629d33c17164 100644 --- a/gfx/layers/Compositor.h +++ b/gfx/layers/Compositor.h @@ -474,7 +474,7 @@ public: virtual void ForcePresent() { } - nsIWidget* GetWidget() const { return mWidget; } + widget::CompositorWidgetProxy* GetWidget() const { return mWidget; } virtual bool HasImageHostOverlays() { return false; } diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 73fdeedf45a5..35ce432398cd 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -853,7 +853,7 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi if (!mTarget && !haveLayerEffects && gfxPrefs::Composer2DCompositionEnabled() && composer2D && composer2D->HasHwc() && composer2D->TryRenderWithHwc(mRoot, - mCompositor->GetWidget(), + mCompositor->GetWidget()->RealWidget(), mGeometryChanged, mCompositor->HasImageHostOverlays())) { @@ -942,12 +942,13 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi js::ProfileEntry::Category::GRAPHICS); mCompositor->EndFrame(); - mCompositor->SetDispAcquireFence(mRoot, - mCompositor->GetWidget()); // Call after EndFrame() + + // Call after EndFrame() + mCompositor->SetDispAcquireFence(mRoot, mCompositor->GetWidget()->RealWidget()); } if (composer2D) { - composer2D->Render(mCompositor->GetWidget()); + composer2D->Render(mCompositor->GetWidget()->RealWidget()); } mCompositor->GetWidget()->PostRender(this); @@ -1546,7 +1547,7 @@ LayerComposite::SetLayerManager(LayerManagerComposite* aManager) bool LayerManagerComposite::AsyncPanZoomEnabled() const { - return mCompositor->GetWidget()->AsyncPanZoomEnabled(); + return mCompositor->GetWidget()->RealWidget()->AsyncPanZoomEnabled(); } nsIntRegion diff --git a/gfx/layers/opengl/CompositingRenderTargetOGL.cpp b/gfx/layers/opengl/CompositingRenderTargetOGL.cpp index af745ff3e821..52de9b0a633e 100644 --- a/gfx/layers/opengl/CompositingRenderTargetOGL.cpp +++ b/gfx/layers/opengl/CompositingRenderTargetOGL.cpp @@ -51,7 +51,7 @@ CompositingRenderTargetOGL::BindRenderTarget() // The main framebuffer (0) of non-offscreen contexts // might be backed by a EGLSurface that needs to be renewed. if (mFBO == 0 && !mGL->IsOffscreen()) { - mGL->RenewSurface(mCompositor->GetWidget()); + mGL->RenewSurface(mCompositor->GetWidget()->RealWidget()); result = mGL->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER); } if (result != LOCAL_GL_FRAMEBUFFER_COMPLETE) { diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index eb3039a7a920..21e6fce57c72 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -1599,7 +1599,7 @@ CompositorOGL::Resume() return false; // RenewSurface internally calls MakeCurrent. - return gl()->RenewSurface(GetWidget()); + return gl()->RenewSurface(GetWidget()->RealWidget()); #endif return true; } diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index a04a76f05a9f..370fab6fb82f 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -1248,16 +1248,6 @@ class nsIWidget */ virtual void PrepareWindowEffects() = 0; - /** - * A hook for the widget to prepare a Compositor, during the latter's initialization. - * - * If this method returns true, it means that the widget will be able to - * present frames from the compoositor. - * Returning false will cause the compositor's initialization to fail, and - * a different compositor backend will be used (if any). - */ - virtual bool InitCompositor(mozilla::layers::Compositor*) { return true; } - /** * Called when Gecko knows which themed widgets exist in this window. * The passed array contains an entry for every themed widget of the right @@ -1856,12 +1846,6 @@ public: */ NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) = 0; - /** - * Return the internal format of the default framebuffer for this - * widget. - */ - virtual uint32_t GetGLFrameBufferFormat() { return 0; /*GL_NONE*/ } - /** * Return true if widget has it's own GL context */