Bug 990876 - Remove TextureClientSurface. r=mattwoodrow
authorNicolas Silva <nical@mozilla.com>
Mon, 14 Apr 2014 21:29:42 +0200
changeset 196898 37dda4e50b2456cadd4548f55ffb6d18a48fad0a
parent 196897 e2d5b2be4142f7407be4e58afb9a23eba667105f
child 196899 e2cf132023bea2a8559ad8cf83b013815553e856
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs990876
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 990876 - Remove TextureClientSurface. r=mattwoodrow
gfx/layers/basic/TextureClientX11.h
gfx/layers/client/CanvasClient.cpp
gfx/layers/client/TextureClient.h
gfx/tests/gtest/TestTextures.cpp
--- a/gfx/layers/basic/TextureClientX11.h
+++ b/gfx/layers/basic/TextureClientX11.h
@@ -11,29 +11,25 @@
 #include "mozilla/layers/ShadowLayerUtilsX11.h"
 
 namespace mozilla {
 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);
 
   ~TextureClientX11();
 
   // TextureClient
 
-  virtual TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; }
-
   virtual bool IsAllocated() const MOZ_OVERRIDE;
 
   virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
 
   virtual TextureClientData* DropTextureData() MOZ_OVERRIDE;
 
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
 
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -69,18 +69,18 @@ CanvasClient2D::Update(gfx::IntSize aSiz
       = gfxPlatform::GetPlatform()->OptimalFormatForContent(contentType);
     uint32_t flags = TEXTURE_FLAGS_DEFAULT;
     if (mTextureFlags & TEXTURE_NEEDS_Y_FLIP) {
       flags |= TEXTURE_NEEDS_Y_FLIP;
     }
     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;
   }
 
   if (!mBuffer->Lock(OPEN_WRITE_ONLY)) {
     mBuffer = nullptr;
     return;
   }
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -45,44 +45,24 @@ class Image;
 class PTextureChild;
 class TextureChild;
 class BufferTextureClient;
 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 {
   ALLOC_DEFAULT = 0,
   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.
  */
 class TextureClientYCbCr
 {
 public:
   /**
    * Copy aData into this texture client.
    *
@@ -162,17 +142,16 @@ public:
 
   static TemporaryRef<TextureClient>
   CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
                                 gfx::SurfaceFormat aFormat,
                                 TextureFlags aTextureFlags,
                                 gfx::BackendType aMoz2dBackend,
                                 const gfx::IntSize& aSizeHint);
 
-  virtual TextureClientSurface* AsTextureClientSurface() { return nullptr; }
   virtual TextureClientYCbCr* AsTextureClientYCbCr() { return nullptr; }
 
   /**
    * Locks the shared data, allowing the caller to get access to it.
    *
    * Please always lock/unlock when accessing the shared data.
    * If Lock() returns false, you should not attempt to access the shared data.
    */
@@ -405,17 +384,16 @@ protected:
 };
 
 /**
  * TextureClient that wraps a random access buffer such as a Shmem or raw memory.
  * This class must be inherited to implement the memory allocation and access bits.
  * (see ShmemTextureClient and MemoryTextureClient)
  */
 class BufferTextureClient : public TextureClient
-                          , public TextureClientSurface
                           , public TextureClientYCbCr
 {
 public:
   BufferTextureClient(ISurfaceAllocator* aAllocator, gfx::SurfaceFormat aFormat,
                       gfx::BackendType aBackend, TextureFlags aFlags);
 
   virtual ~BufferTextureClient();
 
@@ -430,20 +408,16 @@ public:
   virtual void Unlock() MOZ_OVERRIDE;
 
   virtual bool IsLocked() const MOZ_OVERRIDE { return mLocked; }
 
   virtual bool CanExposeDrawTarget() const MOZ_OVERRIDE { return true; }
 
   virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
 
-  // TextureClientSurface
-
-  virtual TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; }
-
   virtual bool AllocateForSurface(gfx::IntSize aSize,
                                   TextureAllocationFlags aFlags = ALLOC_DEFAULT) MOZ_OVERRIDE;
 
   // TextureClientYCbCr
 
   virtual TextureClientYCbCr* AsTextureClientYCbCr() MOZ_OVERRIDE { return this; }
 
   virtual bool UpdateYCbCr(const PlanarYCbCrData& aData) MOZ_OVERRIDE;
--- a/gfx/tests/gtest/TestTextures.cpp
+++ b/gfx/tests/gtest/TestTextures.cpp
@@ -142,19 +142,18 @@ void AssertYCbCrSurfacesEqual(PlanarYCbC
     }
   }
 }
 
 // Run the test for a texture client and a surface
 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));
   // client painting
   RefPtr<DrawTarget> dt = texture->GetAsDrawTarget();
   RefPtr<SourceSurface> source =
     gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, surface);
   dt->CopySurface(source, IntRect(IntPoint(), source->GetSize()), IntPoint());