From f7668eb0242364d265d06260eaf502ddff83c636 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Mon, 14 Apr 2014 21:29:42 +0200 Subject: [PATCH] Bug 990876 - Remove TextureClientSurface. r=mattwoodrow --- gfx/layers/basic/TextureClientX11.h | 6 +----- gfx/layers/client/CanvasClient.cpp | 4 ++-- gfx/layers/client/TextureClient.h | 26 -------------------------- gfx/tests/gtest/TestTextures.cpp | 5 ++--- 4 files changed, 5 insertions(+), 36 deletions(-) diff --git a/gfx/layers/basic/TextureClientX11.h b/gfx/layers/basic/TextureClientX11.h index 6ce24bcf3d4a..2f08c3bd20f8 100644 --- a/gfx/layers/basic/TextureClientX11.h +++ b/gfx/layers/basic/TextureClientX11.h @@ -16,9 +16,7 @@ namespace layers { /** * A TextureClient implementation based on Xlib. */ -class TextureClientX11 - : public TextureClient, - public TextureClientSurface +class TextureClientX11 : public TextureClient { public: TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT); @@ -27,8 +25,6 @@ class TextureClientX11 // TextureClient - virtual TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; } - virtual bool IsAllocated() const MOZ_OVERRIDE; virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE; diff --git a/gfx/layers/client/CanvasClient.cpp b/gfx/layers/client/CanvasClient.cpp index 8b940fa5da38..571d031760d6 100644 --- a/gfx/layers/client/CanvasClient.cpp +++ b/gfx/layers/client/CanvasClient.cpp @@ -74,8 +74,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.h b/gfx/layers/client/TextureClient.h index 813c6f008e95..f7538c183b15 100644 --- a/gfx/layers/client/TextureClient.h +++ b/gfx/layers/client/TextureClient.h @@ -50,9 +50,6 @@ class TextureClient; /** * 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. */ enum TextureAllocationFlags { @@ -60,23 +57,6 @@ enum TextureAllocationFlags { ALLOC_CLEAR_BUFFER = 1 }; -/** - * Interface for TextureClients that can be updated using a gfxASurface. - */ -class TextureClientSurface -{ -public: - /** - * 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. */ @@ -167,7 +147,6 @@ public: gfx::BackendType aMoz2dBackend, const gfx::IntSize& aSizeHint); - virtual TextureClientSurface* AsTextureClientSurface() { return nullptr; } virtual TextureClientYCbCr* AsTextureClientYCbCr() { return nullptr; } /** @@ -410,7 +389,6 @@ protected: * (see ShmemTextureClient and MemoryTextureClient) */ class BufferTextureClient : public TextureClient - , public TextureClientSurface , public TextureClientYCbCr { public: @@ -435,10 +413,6 @@ public: virtual TemporaryRef GetAsDrawTarget() MOZ_OVERRIDE; - // TextureClientSurface - - virtual TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; } - virtual bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags aFlags = ALLOC_DEFAULT) MOZ_OVERRIDE; diff --git a/gfx/tests/gtest/TestTextures.cpp b/gfx/tests/gtest/TestTextures.cpp index d2ae73d6dc6a..c54ea76b9005 100644 --- a/gfx/tests/gtest/TestTextures.cpp +++ b/gfx/tests/gtest/TestTextures.cpp @@ -147,9 +147,8 @@ void AssertYCbCrSurfacesEqual(PlanarYCbCrData* surface1, void TestTextureClientSurface(TextureClient* texture, gfxImageSurface* surface) { // client allocation - ASSERT_TRUE(texture->AsTextureClientSurface() != nullptr); - TextureClientSurface* client = texture->AsTextureClientSurface(); - client->AllocateForSurface(ToIntSize(surface->GetSize())); + ASSERT_TRUE(texture->CanExposeDrawTarget()); + texture->AllocateForSurface(ToIntSize(surface->GetSize())); ASSERT_TRUE(texture->IsAllocated()); ASSERT_TRUE(texture->Lock(OPEN_READ_WRITE));