mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1592150 - Remove CurrentSurfaceInvalidRegion(). Callers now always just repaint the update region that they supplied. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D51761 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
274b0d6329
commit
3faf29b5c5
@ -91,13 +91,13 @@ class NativeLayer {
|
||||
// Returns a DrawTarget. The size of the DrawTarget will be the same as the
|
||||
// size of this layer. The caller should draw to that DrawTarget, then drop
|
||||
// its reference to the DrawTarget, and then call NotifySurfaceReady(). It can
|
||||
// limit its drawing to CurrentSurfaceInvalidRegion() (which is in the
|
||||
// DrawTarget's device space). After a call to NextSurface*, NextSurface* must
|
||||
// not be called again until after NotifySurfaceReady has been called. Can be
|
||||
// called on any thread. When used from multiple threads, callers need to make
|
||||
// sure that they still only call NextSurface* and NotifySurfaceReady
|
||||
// alternatingly and not in any other order.
|
||||
// aUpdateRegion must not extend beyond the layer size.
|
||||
// limit its drawing to aUpdateRegion (which is in the DrawTarget's device
|
||||
// space). After a call to NextSurface*, NextSurface* must not be called again
|
||||
// until after NotifySurfaceReady has been called. Can be called on any
|
||||
// thread. When used from multiple threads, callers need to make sure that
|
||||
// they still only call NextSurface* and NotifySurfaceReady alternatingly and
|
||||
// not in any other order. aUpdateRegion must not extend beyond the layer
|
||||
// size.
|
||||
virtual RefPtr<gfx::DrawTarget> NextSurfaceAsDrawTarget(
|
||||
const gfx::IntRegion& aUpdateRegion, gfx::BackendType aBackendType) = 0;
|
||||
|
||||
@ -115,31 +115,22 @@ class NativeLayer {
|
||||
// surface. The size of the framebuffer will be the same as the size of this
|
||||
// layer. If aNeedsDepth is true, the framebuffer is created with a depth
|
||||
// buffer. The caller should draw to the framebuffer, unbind it, and then call
|
||||
// NotifySurfaceReady(). It can limit its drawing to
|
||||
// CurrentSurfaceInvalidRegion() (which is in the framebuffer's device space,
|
||||
// possibly "upside down" if SurfaceIsFlipped()). The framebuffer will be
|
||||
// created using the GLContext that was set on this layer with a call to
|
||||
// SetGLContext. The NativeLayer will keep a reference to the MozFramebuffer
|
||||
// so that it can reuse the same MozFramebuffer whenever it uses the same
|
||||
// underlying surface. Calling SetGLContext with a different context will
|
||||
// release that reference. After a call to NextSurface*, NextSurface* must not
|
||||
// be called again until after NotifySurfaceReady has been called. Can be
|
||||
// called on any thread. When used from multiple threads, callers need to make
|
||||
// sure that they still only call NextSurface and NotifySurfaceReady
|
||||
// alternatingly and not in any other order.
|
||||
// NotifySurfaceReady(). It can limit its drawing to aUpdateRegion (which is
|
||||
// in the framebuffer's device space, possibly "upside down" if
|
||||
// SurfaceIsFlipped()). The framebuffer will be created using the GLContext
|
||||
// that was set on this layer with a call to SetGLContext. The NativeLayer
|
||||
// will keep a reference to the MozFramebuffer so that it can reuse the same
|
||||
// MozFramebuffer whenever it uses the same underlying surface. Calling
|
||||
// SetGLContext with a different context will release that reference. After a
|
||||
// call to NextSurface*, NextSurface* must not be called again until after
|
||||
// NotifySurfaceReady has been called. Can be called on any thread. When used
|
||||
// from multiple threads, callers need to make sure that they still only call
|
||||
// NextSurface and NotifySurfaceReady alternatingly and not in any other
|
||||
// order.
|
||||
// aUpdateRegion must not extend beyond the layer size.
|
||||
virtual Maybe<GLuint> NextSurfaceAsFramebuffer(
|
||||
const gfx::IntRegion& aUpdateRegion, bool aNeedsDepth) = 0;
|
||||
|
||||
// The invalid region of the surface that has been returned from the most
|
||||
// recent call to NextSurface*. Newly-created surfaces are entirely invalid.
|
||||
// For surfaces that have been used before, the invalid region is the union of
|
||||
// all invalid regions that have been passed to NextSurface* since the last
|
||||
// time that NotifySurfaceReady was called for this surface. Can only be
|
||||
// called between calls to NextSurface* and NotifySurfaceReady. Can be called
|
||||
// on any thread.
|
||||
virtual gfx::IntRegion CurrentSurfaceInvalidRegion() = 0;
|
||||
|
||||
// Indicates that the surface which has been returned from the most recent
|
||||
// call to NextSurface* is now finished being drawn to and can be displayed on
|
||||
// the screen. Resets the invalid region on the surface to the empty region.
|
||||
|
@ -96,7 +96,6 @@ class NativeLayerCA : public NativeLayer {
|
||||
gl::GLContext* GetGLContext() override;
|
||||
Maybe<GLuint> NextSurfaceAsFramebuffer(const gfx::IntRegion& aUpdateRegion,
|
||||
bool aNeedsDepth) override;
|
||||
gfx::IntRegion CurrentSurfaceInvalidRegion() override;
|
||||
void NotifySurfaceReady() override;
|
||||
bool IsOpaque() override;
|
||||
void SetClipRect(const Maybe<gfx::IntRect>& aClipRect) override;
|
||||
|
@ -221,16 +221,6 @@ Maybe<gfx::IntRect> NativeLayerCA::ClipRect() {
|
||||
return mClipRect;
|
||||
}
|
||||
|
||||
IntRegion NativeLayerCA::CurrentSurfaceInvalidRegion() {
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
MOZ_RELEASE_ASSERT(
|
||||
mInProgressSurface,
|
||||
"Only call currentSurfaceInvalidRegion after a call to NextSurface and before the call "
|
||||
"to notifySurfaceIsReady.");
|
||||
return mInProgressSurface->mInvalidRegion;
|
||||
}
|
||||
|
||||
void NativeLayerCA::InvalidateRegionThroughoutSwapchain(const MutexAutoLock&,
|
||||
const IntRegion& aRegion) {
|
||||
IntRegion r = aRegion;
|
||||
|
@ -1039,9 +1039,6 @@ Maybe<gfx::IntRect> BasicCompositor::BeginRenderingToNativeLayer(
|
||||
if (!dt) {
|
||||
return Nothing();
|
||||
}
|
||||
invalidRelativeToLayer = aNativeLayer->CurrentSurfaceInvalidRegion();
|
||||
mInvalidRegion = invalidRelativeToLayer.MovedBy(rect.TopLeft());
|
||||
MOZ_RELEASE_ASSERT(!mInvalidRegion.IsEmpty());
|
||||
mCurrentNativeLayer = aNativeLayer;
|
||||
IntRegion clearRegion;
|
||||
clearRegion.Sub(mInvalidRegion, aOpaqueRegion);
|
||||
|
@ -758,7 +758,7 @@ void CompositorOGL::ClearRect(const gfx::Rect& aRect) {
|
||||
|
||||
already_AddRefed<CompositingRenderTargetOGL>
|
||||
CompositorOGL::RenderTargetForNativeLayer(NativeLayer* aNativeLayer,
|
||||
IntRegion& aInvalidRegion) {
|
||||
const IntRegion& aInvalidRegion) {
|
||||
if (aInvalidRegion.IsEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -775,9 +775,6 @@ CompositorOGL::RenderTargetForNativeLayer(NativeLayer* aNativeLayer,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
invalidRelativeToLayer = aNativeLayer->CurrentSurfaceInvalidRegion();
|
||||
aInvalidRegion = invalidRelativeToLayer.MovedBy(layerRect.TopLeft());
|
||||
|
||||
RefPtr<CompositingRenderTargetOGL> rt =
|
||||
CompositingRenderTargetOGL::CreateForExternallyOwnedFBO(
|
||||
this, *fbo, layerRect, IntPoint());
|
||||
|
@ -145,11 +145,10 @@ class CompositorOGL final : public Compositor {
|
||||
}
|
||||
|
||||
// Returns a render target for the native layer.
|
||||
// aInvalidRegion will be mutated to include existing invalid areas in the
|
||||
// layer. aInvalidRegion is in window coordinates, i.e. in the same space
|
||||
// as aNativeLayer->GetRect().
|
||||
// aInvalidRegion is in window coordinates, i.e. in the same space as
|
||||
// aNativeLayer->GetPosition().
|
||||
already_AddRefed<CompositingRenderTargetOGL> RenderTargetForNativeLayer(
|
||||
NativeLayer* aNativeLayer, gfx::IntRegion& aInvalidRegion);
|
||||
NativeLayer* aNativeLayer, const gfx::IntRegion& aInvalidRegion);
|
||||
|
||||
already_AddRefed<CompositingRenderTarget> CreateRenderTarget(
|
||||
const gfx::IntRect& aRect, SurfaceInitMode aInit) override;
|
||||
|
@ -1354,9 +1354,7 @@ void nsChildView::PaintWindowInContentLayer() {
|
||||
return;
|
||||
}
|
||||
|
||||
PaintWindowInDrawTarget(
|
||||
dt, LayoutDeviceIntRegion::FromUnknownRegion(mContentLayer->CurrentSurfaceInvalidRegion()),
|
||||
dt->GetSize());
|
||||
PaintWindowInDrawTarget(dt, mContentLayerInvalidRegion, dt->GetSize());
|
||||
mContentLayer->NotifySurfaceReady();
|
||||
mContentLayerInvalidRegion.SetEmpty();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user