diff --git a/gfx/layers/basic/TextureClientX11.cpp b/gfx/layers/basic/TextureClientX11.cpp index aba9e39be4c7..d1975149d01e 100644 --- a/gfx/layers/basic/TextureClientX11.cpp +++ b/gfx/layers/basic/TextureClientX11.cpp @@ -77,34 +77,6 @@ TextureClientX11::DropTextureData() return nullptr; } -bool -TextureClientX11::UpdateSurface(gfxASurface* aSurface) -{ - MOZ_ASSERT(IsValid()); - - RefPtr dt = GetAsDrawTarget(); - if (!dt) { - return false; - } - - RefPtr source = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, aSurface); - dt->CopySurface(source, IntRect(IntPoint(), GetSize()), IntPoint()); - - return true; -} - -already_AddRefed -TextureClientX11::GetAsSurface() -{ - MOZ_ASSERT(IsValid()); - if (!mSurface) { - return nullptr; - } - - nsRefPtr temp = mSurface.get(); - return temp.forget(); -} - bool TextureClientX11::AllocateForSurface(IntSize aSize, TextureAllocationFlags aTextureFlags) { diff --git a/gfx/layers/basic/TextureClientX11.h b/gfx/layers/basic/TextureClientX11.h index a5afe195a343..3703d07eaa32 100644 --- a/gfx/layers/basic/TextureClientX11.h +++ b/gfx/layers/basic/TextureClientX11.h @@ -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 GetAsSurface() MOZ_OVERRIDE; bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags flags) MOZ_OVERRIDE; TemporaryRef GetAsDrawTarget() MOZ_OVERRIDE; diff --git a/gfx/layers/client/CanvasClient.cpp b/gfx/layers/client/CanvasClient.cpp index 4918b802bc3d..aa7708bcb3b7 100644 --- a/gfx/layers/client/CanvasClient.cpp +++ b/gfx/layers/client/CanvasClient.cpp @@ -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; } diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 54559efebb2a..155a602417f6 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -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 dt = GetAsDrawTarget(); - RefPtr 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 -BufferTextureClient::GetAsSurface() -{ - MOZ_ASSERT(mLocked); - MOZ_ASSERT(IsValid()); - - ImageDataSerializer serializer(GetBuffer(), GetBufferSize()); - if (!serializer.IsValid()) { - return nullptr; - } - - RefPtr surf = serializer.GetAsThebesSurface(); - nsRefPtr result = surf.get(); - return result.forget(); -} - bool BufferTextureClient::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags aFlags) { diff --git a/gfx/layers/client/TextureClient.h b/gfx/layers/client/TextureClient.h index 665271ce5ada..54aef59e1063 100644 --- a/gfx/layers/client/TextureClient.h +++ b/gfx/layers/client/TextureClient.h @@ -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 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 GetAsDrawTarget() MOZ_OVERRIDE; - // TextureClientSurface - - virtual TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; } - - virtual bool UpdateSurface(gfxASurface* aSurface) MOZ_OVERRIDE; - - virtual already_AddRefed GetAsSurface() MOZ_OVERRIDE; - virtual bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags aFlags = ALLOC_DEFAULT) MOZ_OVERRIDE;