зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1444449 - Do not return raw pointers to window targets from compositors r=bas
Differential Revision: https://phabricator.services.mozilla.com/D18598 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a359caba44
Коммит
3800dbb8ec
|
@ -503,8 +503,10 @@ gfx::IntRect Compositor::ComputeBackdropCopyRect(
|
||||||
const gfx::Matrix4x4& aTransform, gfx::Matrix4x4* aOutTransform,
|
const gfx::Matrix4x4& aTransform, gfx::Matrix4x4* aOutTransform,
|
||||||
gfx::Rect* aOutLayerQuad) {
|
gfx::Rect* aOutLayerQuad) {
|
||||||
// Compute the clip.
|
// Compute the clip.
|
||||||
gfx::IntPoint rtOffset = GetCurrentRenderTarget()->GetOrigin();
|
RefPtr<CompositingRenderTarget> currentRenderTarget =
|
||||||
gfx::IntSize rtSize = GetCurrentRenderTarget()->GetSize();
|
GetCurrentRenderTarget();
|
||||||
|
gfx::IntPoint rtOffset = currentRenderTarget->GetOrigin();
|
||||||
|
gfx::IntSize rtSize = currentRenderTarget->GetSize();
|
||||||
|
|
||||||
return layers::ComputeBackdropCopyRect(aRect, aClipRect, aTransform,
|
return layers::ComputeBackdropCopyRect(aRect, aClipRect, aTransform,
|
||||||
gfx::IntRect(rtOffset, rtSize),
|
gfx::IntRect(rtOffset, rtSize),
|
||||||
|
|
|
@ -292,7 +292,8 @@ class Compositor : public TextureSourceProvider {
|
||||||
* Returns the current target for rendering. Will return null if we are
|
* Returns the current target for rendering. Will return null if we are
|
||||||
* rendering to the screen.
|
* rendering to the screen.
|
||||||
*/
|
*/
|
||||||
virtual CompositingRenderTarget* GetCurrentRenderTarget() const = 0;
|
virtual already_AddRefed<CompositingRenderTarget> GetCurrentRenderTarget()
|
||||||
|
const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a render target which contains the entire window's drawing.
|
* Returns a render target which contains the entire window's drawing.
|
||||||
|
@ -300,7 +301,8 @@ class Compositor : public TextureSourceProvider {
|
||||||
* with buffered BasicCompositor, where only the invalid area is drawn to a
|
* with buffered BasicCompositor, where only the invalid area is drawn to a
|
||||||
* render target), this will return null.
|
* render target), this will return null.
|
||||||
*/
|
*/
|
||||||
virtual CompositingRenderTarget* GetWindowRenderTarget() const {
|
virtual already_AddRefed<CompositingRenderTarget> GetWindowRenderTarget()
|
||||||
|
const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,12 +98,14 @@ class BasicCompositor : public Compositor {
|
||||||
mRenderTarget->BindRenderTarget();
|
mRenderTarget->BindRenderTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual CompositingRenderTarget* GetWindowRenderTarget() const override {
|
virtual already_AddRefed<CompositingRenderTarget> GetWindowRenderTarget()
|
||||||
return mFullWindowRenderTarget;
|
const override {
|
||||||
|
return do_AddRef(mFullWindowRenderTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual CompositingRenderTarget* GetCurrentRenderTarget() const override {
|
virtual already_AddRefed<CompositingRenderTarget> GetCurrentRenderTarget()
|
||||||
return mRenderTarget;
|
const override {
|
||||||
|
return do_AddRef(mRenderTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void DrawQuad(const gfx::Rect& aRect, const gfx::IntRect& aClipRect,
|
virtual void DrawQuad(const gfx::Rect& aRect, const gfx::IntRect& aClipRect,
|
||||||
|
|
|
@ -565,7 +565,7 @@ RefPtr<CompositingRenderTarget> CreateTemporaryTargetAndCopyFromBackground(
|
||||||
!gfx::ThebesMatrix(transform2d).HasNonIntegerTranslation());
|
!gfx::ThebesMatrix(transform2d).HasNonIntegerTranslation());
|
||||||
sourcePoint += gfx::IntPoint::Truncate(transform._41, transform._42);
|
sourcePoint += gfx::IntPoint::Truncate(transform._41, transform._42);
|
||||||
|
|
||||||
sourcePoint -= compositor->GetCurrentRenderTarget()->GetOrigin();
|
sourcePoint -= previousTarget->GetOrigin();
|
||||||
|
|
||||||
return compositor->CreateRenderTargetFromSource(surfaceRect, previousTarget,
|
return compositor->CreateRenderTargetFromSource(surfaceRect, previousTarget,
|
||||||
sourcePoint);
|
sourcePoint);
|
||||||
|
|
|
@ -54,8 +54,9 @@ class CompositorD3D11 : public Compositor {
|
||||||
const gfx::IntPoint& aSourcePoint) override;
|
const gfx::IntPoint& aSourcePoint) override;
|
||||||
|
|
||||||
virtual void SetRenderTarget(CompositingRenderTarget* aSurface) override;
|
virtual void SetRenderTarget(CompositingRenderTarget* aSurface) override;
|
||||||
virtual CompositingRenderTarget* GetCurrentRenderTarget() const override {
|
virtual already_AddRefed<CompositingRenderTarget> GetCurrentRenderTarget()
|
||||||
return mCurrentRT;
|
const override {
|
||||||
|
return do_AddRef(mCurrentRT);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetDestinationSurfaceSize(const gfx::IntSize& aSize) override {}
|
virtual void SetDestinationSurfaceSize(const gfx::IntSize& aSize) override {}
|
||||||
|
|
|
@ -656,12 +656,14 @@ void CompositorOGL::SetRenderTarget(CompositingRenderTarget* aSurface) {
|
||||||
PrepareViewport(mCurrentRenderTarget);
|
PrepareViewport(mCurrentRenderTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
CompositingRenderTarget* CompositorOGL::GetCurrentRenderTarget() const {
|
already_AddRefed<CompositingRenderTarget>
|
||||||
return mCurrentRenderTarget;
|
CompositorOGL::GetCurrentRenderTarget() const {
|
||||||
|
return do_AddRef(mCurrentRenderTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
CompositingRenderTarget* CompositorOGL::GetWindowRenderTarget() const {
|
already_AddRefed<CompositingRenderTarget> CompositorOGL::GetWindowRenderTarget()
|
||||||
return mWindowRenderTarget;
|
const {
|
||||||
|
return do_AddRef(mWindowRenderTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<AsyncReadbackBuffer> CompositorOGL::CreateAsyncReadbackBuffer(
|
already_AddRefed<AsyncReadbackBuffer> CompositorOGL::CreateAsyncReadbackBuffer(
|
||||||
|
|
|
@ -155,8 +155,10 @@ class CompositorOGL final : public Compositor {
|
||||||
const gfx::IntPoint& aSourcePoint) override;
|
const gfx::IntPoint& aSourcePoint) override;
|
||||||
|
|
||||||
virtual void SetRenderTarget(CompositingRenderTarget* aSurface) override;
|
virtual void SetRenderTarget(CompositingRenderTarget* aSurface) override;
|
||||||
virtual CompositingRenderTarget* GetCurrentRenderTarget() const override;
|
virtual already_AddRefed<CompositingRenderTarget> GetCurrentRenderTarget()
|
||||||
virtual CompositingRenderTarget* GetWindowRenderTarget() const override;
|
const override;
|
||||||
|
virtual already_AddRefed<CompositingRenderTarget> GetWindowRenderTarget()
|
||||||
|
const override;
|
||||||
|
|
||||||
virtual bool ReadbackRenderTarget(CompositingRenderTarget* aSource,
|
virtual bool ReadbackRenderTarget(CompositingRenderTarget* aSource,
|
||||||
AsyncReadbackBuffer* aDest) override;
|
AsyncReadbackBuffer* aDest) override;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче