mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
7507ff06bc
--HG-- extra : rebase_source : 92be3f39d6e07d1e5f5de0a484a0c94eca93a97c
98 lines
2.6 KiB
C++
98 lines
2.6 KiB
C++
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef MOZILLA_GFX_CANVASCLIENT_H
|
|
#define MOZILLA_GFX_CANVASCLIENT_H
|
|
|
|
#include "mozilla/layers/TextureClient.h"
|
|
#include "mozilla/layers/CompositableClient.h"
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
class ClientCanvasLayer;
|
|
|
|
/**
|
|
* Compositable client for 2d and webgl canvas.
|
|
*/
|
|
class CanvasClient : public CompositableClient
|
|
{
|
|
public:
|
|
/**
|
|
* Creates, configures, and returns a new canvas client. If necessary, a
|
|
* message will be sent to the compositor to create a corresponding image
|
|
* host.
|
|
*/
|
|
enum CanvasClientType {
|
|
CanvasClientSurface,
|
|
CanvasClientGLContext,
|
|
};
|
|
static TemporaryRef<CanvasClient> CreateCanvasClient(CanvasClientType aType,
|
|
CompositableForwarder* aFwd,
|
|
TextureFlags aFlags);
|
|
|
|
CanvasClient(CompositableForwarder* aFwd, TextureFlags aFlags)
|
|
: CompositableClient(aFwd)
|
|
{
|
|
mTextureInfo.mTextureFlags = aFlags;
|
|
}
|
|
|
|
virtual ~CanvasClient() {}
|
|
|
|
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) = 0;
|
|
|
|
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
|
|
{
|
|
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);
|
|
|
|
TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
|
{
|
|
return mTextureInfo;
|
|
}
|
|
|
|
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer);
|
|
virtual void Updated() MOZ_OVERRIDE;
|
|
|
|
private:
|
|
bool mNeedsUpdate;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif
|