Bug 893302 - Rename the CanvasClient class to include Deprecated so we can implement one on top of NewTextureHost. r=nical

This commit is contained in:
Matt Woodrow 2013-08-03 13:29:28 -04:00
parent e49181d0be
commit 1afc70d202
3 changed files with 49 additions and 38 deletions

View File

@ -28,27 +28,27 @@ CanvasClient::CreateCanvasClient(CanvasClientType aType,
{
if (aType == CanvasClientGLContext &&
aForwarder->GetCompositorBackendType() == LAYERS_OPENGL) {
return new CanvasClientSurfaceStream(aForwarder, aFlags);
return new DeprecatedCanvasClientSurfaceStream(aForwarder, aFlags);
}
return new CanvasClient2D(aForwarder, aFlags);
return new DeprecatedCanvasClient2D(aForwarder, aFlags);
}
void
CanvasClient::Updated()
DeprecatedCanvasClient2D::Updated()
{
mForwarder->UpdateTexture(this, 1, mDeprecatedTextureClient->GetDescriptor());
}
CanvasClient2D::CanvasClient2D(CompositableForwarder* aFwd,
TextureFlags aFlags)
DeprecatedCanvasClient2D::DeprecatedCanvasClient2D(CompositableForwarder* aFwd,
TextureFlags aFlags)
: CanvasClient(aFwd, aFlags)
{
mTextureInfo.mCompositableType = BUFFER_IMAGE_SINGLE;
}
void
CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
DeprecatedCanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
{
if (!mDeprecatedTextureClient) {
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT);
@ -67,7 +67,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
}
void
CanvasClientSurfaceStream::Updated()
DeprecatedCanvasClientSurfaceStream::Updated()
{
if (mNeedsUpdate) {
mForwarder->UpdateTextureNoSwap(this, 1, mDeprecatedTextureClient->GetDescriptor());
@ -76,8 +76,8 @@ CanvasClientSurfaceStream::Updated()
}
CanvasClientSurfaceStream::CanvasClientSurfaceStream(CompositableForwarder* aFwd,
TextureFlags aFlags)
DeprecatedCanvasClientSurfaceStream::DeprecatedCanvasClientSurfaceStream(CompositableForwarder* aFwd,
TextureFlags aFlags)
: CanvasClient(aFwd, aFlags)
, mNeedsUpdate(false)
{
@ -85,7 +85,7 @@ CanvasClientSurfaceStream::CanvasClientSurfaceStream(CompositableForwarder* aFwd
}
void
CanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
DeprecatedCanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
{
if (!mDeprecatedTextureClient) {
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_STREAM_GL);

View File

@ -44,40 +44,18 @@ public:
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) = 0;
virtual void Updated();
virtual void Updated() { }
virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE
{
mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
}
protected:
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
TextureInfo mTextureInfo;
};
// Used for 2D canvases and WebGL canvas on non-GL systems where readback is requried.
class CanvasClient2D : public CanvasClient
class DeprecatedCanvasClient2D : public CanvasClient
{
public:
CanvasClient2D(CompositableForwarder* aLayerForwarder,
TextureFlags aFlags);
TextureInfo GetTextureInfo() const MOZ_OVERRIDE
{
return mTextureInfo;
}
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer);
};
// Used for GL canvases where we don't need to do any readback, i.e., with a
// GL backend.
class CanvasClientSurfaceStream : public CanvasClient
{
public:
CanvasClientSurfaceStream(CompositableForwarder* aFwd,
TextureFlags aFlags);
DeprecatedCanvasClient2D(CompositableForwarder* aLayerForwarder,
TextureFlags aFlags);
TextureInfo GetTextureInfo() const MOZ_OVERRIDE
{
@ -87,7 +65,40 @@ public:
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer);
virtual void Updated() MOZ_OVERRIDE;
virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE
{
mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
}
private:
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
};
// Used for GL canvases where we don't need to do any readback, i.e., with a
// GL backend.
class DeprecatedCanvasClientSurfaceStream : public CanvasClient
{
public:
DeprecatedCanvasClientSurfaceStream(CompositableForwarder* aFwd,
TextureFlags aFlags);
TextureInfo GetTextureInfo() const MOZ_OVERRIDE
{
return mTextureInfo;
}
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer);
virtual void Updated() MOZ_OVERRIDE;
virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE
{
mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
}
private:
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
bool mNeedsUpdate;
};

View File

@ -86,8 +86,8 @@ protected:
RefPtr<CanvasClient> mCanvasClient;
friend class CanvasClient2D;
friend class CanvasClientSurfaceStream;
friend class DeprecatedCanvasClient2D;
friend class DeprecatedCanvasClientSurfaceStream;
};
}
}