mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 990876 - Remove TextureClientSurface. r=mattwoodrow
This commit is contained in:
parent
d362681d79
commit
7127c26263
@ -77,34 +77,6 @@ TextureClientX11::DropTextureData()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
TextureClientX11::UpdateSurface(gfxASurface* aSurface)
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
RefPtr<DrawTarget> dt = GetAsDrawTarget();
|
||||
if (!dt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<SourceSurface> source = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, aSurface);
|
||||
dt->CopySurface(source, IntRect(IntPoint(), GetSize()), IntPoint());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
TextureClientX11::GetAsSurface()
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
if (!mSurface) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<gfxASurface> temp = mSurface.get();
|
||||
return temp.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
TextureClientX11::AllocateForSurface(IntSize aSize, TextureAllocationFlags aTextureFlags)
|
||||
{
|
||||
|
@ -17,17 +17,12 @@ namespace layers {
|
||||
* A TextureClient implementation based on Xlib.
|
||||
*/
|
||||
class TextureClientX11
|
||||
: public TextureClient,
|
||||
public TextureClientSurface
|
||||
: public TextureClient
|
||||
{
|
||||
public:
|
||||
TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
|
||||
~TextureClientX11();
|
||||
|
||||
// TextureClient
|
||||
|
||||
TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; }
|
||||
|
||||
bool IsAllocated() const MOZ_OVERRIDE;
|
||||
bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
TextureClientData* DropTextureData() MOZ_OVERRIDE;
|
||||
@ -39,10 +34,6 @@ class TextureClientX11
|
||||
void Unlock() MOZ_OVERRIDE;
|
||||
bool IsLocked() const MOZ_OVERRIDE { return mLocked; }
|
||||
|
||||
// TextureClientSurface
|
||||
|
||||
bool UpdateSurface(gfxASurface* aSurface) MOZ_OVERRIDE;
|
||||
already_AddRefed<gfxASurface> GetAsSurface() MOZ_OVERRIDE;
|
||||
bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags flags) MOZ_OVERRIDE;
|
||||
|
||||
TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
|
||||
|
@ -68,8 +68,8 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
||||
mBuffer = CreateBufferTextureClient(gfx::ImageFormatToSurfaceFormat(format),
|
||||
flags,
|
||||
gfxPlatform::GetPlatform()->GetPreferredCanvasBackend());
|
||||
MOZ_ASSERT(mBuffer->AsTextureClientSurface());
|
||||
mBuffer->AsTextureClientSurface()->AllocateForSurface(aSize);
|
||||
MOZ_ASSERT(mBuffer->CanExposeDrawTarget());
|
||||
mBuffer->AllocateForSurface(aSize);
|
||||
|
||||
bufferCreated = true;
|
||||
}
|
||||
|
@ -662,51 +662,6 @@ BufferTextureClient::GetAllocator() const
|
||||
return mAllocator;
|
||||
}
|
||||
|
||||
bool
|
||||
BufferTextureClient::UpdateSurface(gfxASurface* aSurface)
|
||||
{
|
||||
MOZ_ASSERT(mLocked);
|
||||
MOZ_ASSERT(aSurface);
|
||||
MOZ_ASSERT(!IsImmutable());
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
ImageDataSerializer serializer(GetBuffer(), GetBufferSize());
|
||||
if (!serializer.IsValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> dt = GetAsDrawTarget();
|
||||
RefPtr<SourceSurface> source = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, aSurface);
|
||||
|
||||
dt->CopySurface(source, IntRect(IntPoint(), serializer.GetSize()), IntPoint());
|
||||
// XXX - if the Moz2D backend is D2D, we would be much better off memcpying
|
||||
// the content of the surface directly because with D2D, GetAsDrawTarget is
|
||||
// very expensive.
|
||||
|
||||
if (TextureRequiresLocking(mFlags) && !ImplementsLocking()) {
|
||||
// We don't have support for proper locking yet, so we'll
|
||||
// have to be immutable instead.
|
||||
MarkImmutable();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
BufferTextureClient::GetAsSurface()
|
||||
{
|
||||
MOZ_ASSERT(mLocked);
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
ImageDataSerializer serializer(GetBuffer(), GetBufferSize());
|
||||
if (!serializer.IsValid()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<gfxImageSurface> surf = serializer.GetAsThebesSurface();
|
||||
nsRefPtr<gfxASurface> result = surf.get();
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
BufferTextureClient::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags aFlags)
|
||||
{
|
||||
|
@ -50,8 +50,8 @@ class BufferTextureClient;
|
||||
* TextureClient is the abstraction that allows us to share data between the
|
||||
* content and the compositor side.
|
||||
* TextureClient can also provide with some more "producer" facing APIs
|
||||
* such as TextureClientSurface and TextureClientYCbCr, that can be queried
|
||||
* using AsTextureCLientSurface(), etc.
|
||||
* such as TextureClientYCbCr, that can be queried using
|
||||
* AsTextureClientYCbCr(), etc.
|
||||
*/
|
||||
|
||||
enum TextureAllocationFlags {
|
||||
@ -59,25 +59,6 @@ enum TextureAllocationFlags {
|
||||
ALLOC_CLEAR_BUFFER = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for TextureClients that can be updated using a gfxASurface.
|
||||
*/
|
||||
class TextureClientSurface
|
||||
{
|
||||
public:
|
||||
virtual bool UpdateSurface(gfxASurface* aSurface) = 0;
|
||||
virtual already_AddRefed<gfxASurface> GetAsSurface() = 0;
|
||||
/**
|
||||
* Allocates for a given surface size, taking into account the pixel format
|
||||
* which is part of the state of the TextureClient.
|
||||
*
|
||||
* Does not clear the surface by default, clearing the surface can be done
|
||||
* by passing the CLEAR_BUFFER flag.
|
||||
*/
|
||||
virtual bool AllocateForSurface(gfx::IntSize aSize,
|
||||
TextureAllocationFlags flags = ALLOC_DEFAULT) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for TextureClients that can be updated using YCbCr data.
|
||||
*/
|
||||
@ -168,7 +149,6 @@ public:
|
||||
gfx::BackendType aMoz2dBackend,
|
||||
const gfx::IntSize& aSizeHint);
|
||||
|
||||
virtual TextureClientSurface* AsTextureClientSurface() { return nullptr; }
|
||||
virtual TextureClientYCbCr* AsTextureClientYCbCr() { return nullptr; }
|
||||
|
||||
/**
|
||||
@ -392,7 +372,6 @@ protected:
|
||||
* (see ShmemTextureClient and MemoryTextureClient)
|
||||
*/
|
||||
class BufferTextureClient : public TextureClient
|
||||
, public TextureClientSurface
|
||||
, public TextureClientYCbCr
|
||||
{
|
||||
public:
|
||||
@ -419,14 +398,6 @@ public:
|
||||
|
||||
virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
|
||||
|
||||
// TextureClientSurface
|
||||
|
||||
virtual TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; }
|
||||
|
||||
virtual bool UpdateSurface(gfxASurface* aSurface) MOZ_OVERRIDE;
|
||||
|
||||
virtual already_AddRefed<gfxASurface> GetAsSurface() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool AllocateForSurface(gfx::IntSize aSize,
|
||||
TextureAllocationFlags aFlags = ALLOC_DEFAULT) MOZ_OVERRIDE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user