Add IsHidden to CompositorWidget. (bug 1365879 part 10, r=rhunt)

This commit is contained in:
David Anderson
2017-06-20 01:17:19 -07:00
parent 7bb49bf46e
commit 0eb14ec2aa
4 changed files with 15 additions and 1 deletions

View File

@@ -967,7 +967,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion,
// this is important because resizing our buffers when mimised will fail and
// cause a crash when we're restored.
NS_ASSERTION(mHwnd, "Couldn't find an HWND when initialising?");
if (::IsIconic(mHwnd)) {
if (mWidget->IsHidden()) {
// We are not going to render, and not going to call EndFrame so we have to
// read-unlock our textures to prevent them from accumulating.
ReadUnlockTextures();

View File

@@ -257,6 +257,13 @@ public:
return mOptions;
}
/**
* Return true if the window is hidden and should not be composited.
*/
virtual bool IsHidden() const {
return false;
}
/**
* This is only used by out-of-process compositors.
*/

View File

@@ -327,5 +327,11 @@ WinCompositorWidget::FreeWindowSurface(HDC dc)
::ReleaseDC(mWnd, dc);
}
bool
WinCompositorWidget::IsHidden() const
{
return ::IsIconic(mWnd);
}
} // namespace widget
} // namespace mozilla

View File

@@ -64,6 +64,7 @@ public:
CompositorWidgetDelegate* AsDelegate() override {
return this;
}
bool IsHidden() const override;
// CompositorWidgetDelegate overrides.
void EnterPresentLock() override;