Bug 1444432 - Add Compositor::GetWindowRenderTarget() and implement it for CompositorOGL. r=jrmuizel

MozReview-Commit-ID: d0vBM6g2pM

--HG--
extra : rebase_source : d16ad9a58c04c146cd4ef2d95d7eb2ec2cff1593
This commit is contained in:
Markus Stange 2018-03-28 14:44:17 -04:00
Родитель 072ffa8136
Коммит 0e34941ec1
3 изменённых файлов: 18 добавлений и 5 удалений

Просмотреть файл

@ -302,6 +302,14 @@ public:
*/
virtual CompositingRenderTarget* GetCurrentRenderTarget() const = 0;
/**
* Returns a render target which contains the entire window's drawing.
* On platforms where no such render target is used during compositing (e.g.
* with buffered BasicCompositor, where only the invalid area is drawn to a
* render target), this will return null.
*/
virtual CompositingRenderTarget* GetWindowRenderTarget() const { return nullptr; }
/**
* Mostly the compositor will pull the size from a widget and this method will
* be ignored, but compositor implementations are free to use it if they like.

Просмотреть файл

@ -682,6 +682,12 @@ CompositorOGL::GetCurrentRenderTarget() const
return mCurrentRenderTarget;
}
CompositingRenderTarget*
CompositorOGL::GetWindowRenderTarget() const
{
return mWindowRenderTarget;
}
already_AddRefed<AsyncReadbackBuffer>
CompositorOGL::CreateAsyncReadbackBuffer(const IntSize& aSize)
{
@ -816,10 +822,7 @@ CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
CompositingRenderTargetOGL::RenderTargetForWindow(this,
IntSize(width, height));
SetRenderTarget(rt);
#ifdef DEBUG
mWindowRenderTarget = mCurrentRenderTarget;
#endif
if (aClipRectOut && !aClipRectIn) {
aClipRectOut->SetRect(0, 0, width, height);
@ -1752,11 +1755,13 @@ CompositorOGL::EndFrame()
if (mTarget) {
CopyToTarget(mTarget, mTargetBounds.TopLeft(), Matrix());
mGLContext->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, 0);
mWindowRenderTarget = nullptr;
mCurrentRenderTarget = nullptr;
Compositor::EndFrame();
return;
}
mWindowRenderTarget = nullptr;
mCurrentRenderTarget = nullptr;
if (mTexturePool) {

Просмотреть файл

@ -157,6 +157,7 @@ public:
virtual void SetRenderTarget(CompositingRenderTarget *aSurface) override;
virtual CompositingRenderTarget* GetCurrentRenderTarget() const override;
virtual CompositingRenderTarget* GetWindowRenderTarget() const override;
virtual bool
ReadbackRenderTarget(CompositingRenderTarget* aSource,
@ -290,9 +291,8 @@ private:
/** Currently bound render target */
RefPtr<CompositingRenderTargetOGL> mCurrentRenderTarget;
#ifdef DEBUG
CompositingRenderTargetOGL* mWindowRenderTarget;
#endif
/**
* VBO that has some basics in it for a textured quad, including vertex