mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 709490 - Part 6: Add frame ID to CanvasClient so compositor could update frame correctly. r=roc
This commit is contained in:
parent
3ea0cda3c7
commit
e0d17ce5bd
@ -384,7 +384,7 @@ struct ColorLayerProperties : public LayerPropertiesBase
|
||||
IntRect mBounds;
|
||||
};
|
||||
|
||||
static ImageHost* GetImageHost(ImageLayer* aLayer)
|
||||
static ImageHost* GetImageHost(Layer* aLayer)
|
||||
{
|
||||
LayerComposite* composite = aLayer->AsLayerComposite();
|
||||
if (composite) {
|
||||
@ -464,6 +464,34 @@ struct ImageLayerProperties : public LayerPropertiesBase
|
||||
bool mIsMask;
|
||||
};
|
||||
|
||||
struct CanvasLayerProperties : public LayerPropertiesBase
|
||||
{
|
||||
explicit CanvasLayerProperties(CanvasLayer* aCanvas)
|
||||
: LayerPropertiesBase(aCanvas)
|
||||
, mImageHost(GetImageHost(aCanvas))
|
||||
{
|
||||
mFrameID = mImageHost ? mImageHost->GetFrameID() : -1;
|
||||
}
|
||||
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged)
|
||||
{
|
||||
CanvasLayer* canvasLayer = static_cast<CanvasLayer*>(mLayer.get());
|
||||
|
||||
ImageHost* host = GetImageHost(canvasLayer);
|
||||
if (host && host->GetFrameID() != mFrameID) {
|
||||
aGeometryChanged = true;
|
||||
|
||||
return NewTransformedBounds();
|
||||
}
|
||||
|
||||
return IntRect();
|
||||
}
|
||||
|
||||
nsRefPtr<ImageHost> mImageHost;
|
||||
int32_t mFrameID;
|
||||
};
|
||||
|
||||
UniquePtr<LayerPropertiesBase>
|
||||
CloneLayerTreePropertiesInternal(Layer* aRoot, bool aIsMask /* = false */)
|
||||
{
|
||||
@ -482,6 +510,7 @@ CloneLayerTreePropertiesInternal(Layer* aRoot, bool aIsMask /* = false */)
|
||||
case Layer::TYPE_IMAGE:
|
||||
return MakeUnique<ImageLayerProperties>(static_cast<ImageLayer*>(aRoot), aIsMask);
|
||||
case Layer::TYPE_CANVAS:
|
||||
return MakeUnique<CanvasLayerProperties>(static_cast<CanvasLayer*>(aRoot));
|
||||
case Layer::TYPE_READBACK:
|
||||
case Layer::TYPE_SHADOW:
|
||||
case Layer::TYPE_PAINTED:
|
||||
|
@ -125,6 +125,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
||||
CompositableForwarder::TimedTextureClient* t = textures.AppendElement();
|
||||
t->mTextureClient = mBuffer;
|
||||
t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mBuffer->GetSize());
|
||||
t->mFrameID = mFrameID;
|
||||
GetForwarder()->UseTextures(this, textures);
|
||||
mBuffer->SyncWithObject(GetForwarder()->GetSyncObject());
|
||||
}
|
||||
@ -460,6 +461,7 @@ CanvasClientSharedSurface::Updated()
|
||||
CompositableForwarder::TimedTextureClient* t = textures.AppendElement();
|
||||
t->mTextureClient = mFront;
|
||||
t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mFront->GetSize());
|
||||
t->mFrameID = mFrameID;
|
||||
forwarder->UseTextures(this, textures);
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
|
||||
CanvasClient(CompositableForwarder* aFwd, TextureFlags aFlags)
|
||||
: CompositableClient(aFwd, aFlags)
|
||||
, mFrameID(0)
|
||||
{
|
||||
mTextureFlags = aFlags;
|
||||
}
|
||||
@ -67,9 +68,18 @@ public:
|
||||
|
||||
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) = 0;
|
||||
|
||||
virtual bool AddTextureClient(TextureClient* aTexture) override
|
||||
{
|
||||
++mFrameID;
|
||||
return CompositableClient::AddTextureClient(aTexture);
|
||||
}
|
||||
|
||||
virtual void UpdateAsync(AsyncCanvasRenderer* aRenderer) {}
|
||||
|
||||
virtual void Updated() { }
|
||||
|
||||
protected:
|
||||
int32_t mFrameID;
|
||||
};
|
||||
|
||||
// Used for 2D canvases and WebGL canvas on non-GL systems where readback is requried.
|
||||
@ -97,7 +107,7 @@ public:
|
||||
virtual bool AddTextureClient(TextureClient* aTexture) override
|
||||
{
|
||||
MOZ_ASSERT((mTextureFlags & aTexture->GetFlags()) == mTextureFlags);
|
||||
return CompositableClient::AddTextureClient(aTexture);
|
||||
return CanvasClient::AddTextureClient(aTexture);
|
||||
}
|
||||
|
||||
virtual void OnDetach() override
|
||||
|
Loading…
Reference in New Issue
Block a user