Bug 756606. Add LockDrawTarget to shmem texture clients. r=Bas
authorNicholas Cameron <ncameron@mozilla.com>
Mon, 29 Jul 2013 10:12:37 +1200
changeset 152561 bdc535ec42067d3c723821a9bf0ce94c34c887ca
parent 152560 51d91b3220d99b704456954eb79fbe31cbbbfcdf
child 152562 a4535d7fce37999bdf9c40de9ecb3fea6a840e67
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs756606
milestone25.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 756606. Add LockDrawTarget to shmem texture clients. r=Bas
gfx/layers/client/TextureClient.cpp
gfx/layers/client/TextureClient.h
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -115,21 +115,36 @@ DeprecatedTextureClientShmem::GetSurface
                     ? OPEN_READ_WRITE
                     : OPEN_READ_ONLY;
     mSurface = ShadowLayerForwarder::OpenDescriptor(mode, mDescriptor);
   }
 
   return mSurface.get();
 }
 
+
+gfx::DrawTarget*
+DeprecatedTextureClientShmem::LockDrawTarget()
+{
+  if (mDrawTarget) {
+    return mDrawTarget;
+  }
+
+  gfxASurface* surface = GetSurface();
+  mDrawTarget = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(surface, mSize);
+
+  return mDrawTarget;
+}
+
 void
 DeprecatedTextureClientShmem::Unlock()
 {
   mSurface = nullptr;
   mSurfaceAsImage = nullptr;
+  mDrawTarget = nullptr;
 
   ShadowLayerForwarder::CloseDescriptor(mDescriptor);
 }
 
 gfxImageSurface*
 DeprecatedTextureClientShmem::LockImageSurface()
 {
   if (!mSurfaceAsImage) {
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -160,27 +160,29 @@ public:
   ~DeprecatedTextureClientShmem() { ReleaseResources(); }
 
   virtual bool SupportsType(DeprecatedTextureClientType aType) MOZ_OVERRIDE
   {
     return aType == TEXTURE_SHMEM || aType == TEXTURE_CONTENT;
   }
   virtual gfxImageSurface* LockImageSurface() MOZ_OVERRIDE;
   virtual gfxASurface* LockSurface() MOZ_OVERRIDE { return GetSurface(); }
+  virtual gfx::DrawTarget* LockDrawTarget();
   virtual void Unlock() MOZ_OVERRIDE;
   virtual void EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType) MOZ_OVERRIDE;
 
   virtual void ReleaseResources() MOZ_OVERRIDE;
   virtual void SetDescriptor(const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE;
   virtual gfxASurface::gfxContentType GetContentType() MOZ_OVERRIDE { return mContentType; }
 private:
   gfxASurface* GetSurface();
 
   nsRefPtr<gfxASurface> mSurface;
   nsRefPtr<gfxImageSurface> mSurfaceAsImage;
+  RefPtr<gfx::DrawTarget> mDrawTarget;
 
   gfxASurface::gfxContentType mContentType;
   gfx::IntSize mSize;
 
   friend class CompositingFactory;
 };
 
 class DeprecatedTextureClientShmemYCbCr : public DeprecatedTextureClient