Bug 991032 - Cleanup X11 TextureClient/Host. r=mattwoodrow

This commit is contained in:
Nicolas Silva 2014-04-11 16:15:01 +02:00
Родитель 36f271fb97
Коммит 25846a1a69
5 изменённых файлов: 44 добавлений и 34 удалений

Просмотреть файл

@ -40,8 +40,7 @@ TextureClientX11::IsAllocated() const
bool
TextureClientX11::Lock(OpenMode aMode)
{
// XXX - Turn this into a fatal assertion as soon as Bug 952507 is fixed
NS_WARN_IF_FALSE(!mLocked, "The TextureClient is already Locked!");
MOZ_ASSERT(!mLocked, "The TextureClient is already Locked!");
mLocked = IsValid() && IsAllocated();
return mLocked;
}
@ -49,8 +48,7 @@ TextureClientX11::Lock(OpenMode aMode)
void
TextureClientX11::Unlock()
{
// XXX - Turn this into a fatal assertion as soon as Bug 952507 is fixed
NS_WARN_IF_FALSE(mLocked, "The TextureClient is already Unlocked!");
MOZ_ASSERT(mLocked, "The TextureClient is already Unlocked!");
mLocked = false;
if (mSurface) {

Просмотреть файл

@ -22,33 +22,38 @@ class TextureClientX11
{
public:
TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
~TextureClientX11();
// TextureClient
TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; }
virtual TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; }
bool IsAllocated() const MOZ_OVERRIDE;
bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
TextureClientData* DropTextureData() MOZ_OVERRIDE;
gfx::IntSize GetSize() const {
return mSize;
}
virtual bool IsAllocated() const MOZ_OVERRIDE;
bool Lock(OpenMode aMode) MOZ_OVERRIDE;
void Unlock() MOZ_OVERRIDE;
bool IsLocked() const MOZ_OVERRIDE { return mLocked; }
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
// TextureClientSurface
virtual TextureClientData* DropTextureData() MOZ_OVERRIDE;
bool UpdateSurface(gfxASurface* aSurface) MOZ_OVERRIDE;
already_AddRefed<gfxASurface> GetAsSurface() MOZ_OVERRIDE;
bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags flags) MOZ_OVERRIDE;
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
gfx::SurfaceFormat GetFormat() const {
return mFormat;
}
virtual bool Lock(OpenMode aMode) MOZ_OVERRIDE;
virtual void Unlock() MOZ_OVERRIDE;
virtual bool IsLocked() const MOZ_OVERRIDE { return mLocked; }
virtual bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags flags) MOZ_OVERRIDE;
virtual bool CanExposeDrawTarget() const MOZ_OVERRIDE { return true; }
virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
virtual gfx::SurfaceFormat GetFormat() const { return mFormat; }
virtual bool UpdateSurface(gfxASurface* aSurface) MOZ_OVERRIDE;
virtual already_AddRefed<gfxASurface> GetAsSurface() MOZ_OVERRIDE;
virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return false; }

Просмотреть файл

@ -16,8 +16,8 @@ class BasicCompositor;
// TextureSource for Xlib-backed surfaces.
class X11TextureSourceBasic
: public TextureSourceBasic,
public NewTextureSource
: public TextureSourceBasic
, public NewTextureSource
{
public:
X11TextureSourceBasic(BasicCompositor* aCompositor, gfxXlibSurface* aSurface);
@ -25,7 +25,9 @@ public:
virtual X11TextureSourceBasic* AsSourceBasic() MOZ_OVERRIDE { return this; }
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
virtual gfx::SourceSurface* GetSurface() MOZ_OVERRIDE;
virtual void DeallocateDeviceData() MOZ_OVERRIDE { }

Просмотреть файл

@ -8,14 +8,14 @@
#include "mozilla/layers/TextureHost.h"
#include "mozilla/layers/LayersSurfaces.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Types.h"
class gfxXlibSurface;
namespace mozilla {
namespace layers {
// TextureSource for Xlib-backed TextureSources.
// TextureHost for Xlib-backed TextureSources.
class X11TextureHost : public TextureHost
{
public:
@ -23,8 +23,11 @@ public:
const SurfaceDescriptorX11& aDescriptor);
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
virtual bool Lock() MOZ_OVERRIDE;
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
virtual NewTextureSource* GetTextureSources() MOZ_OVERRIDE

Просмотреть файл

@ -16,8 +16,8 @@ namespace layers {
// TextureSource for Xlib-backed surfaces.
class X11TextureSourceOGL
: public TextureSourceOGL,
public NewTextureSource
: public TextureSourceOGL
, public NewTextureSource
{
public:
X11TextureSourceOGL(CompositorOGL* aCompositor, gfxXlibSurface* aSurface);
@ -26,21 +26,23 @@ public:
virtual X11TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
virtual bool IsValid() const MOZ_OVERRIDE { return !!gl(); } ;
virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) MOZ_OVERRIDE;
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
virtual GLenum GetTextureTarget() const MOZ_OVERRIDE {
return LOCAL_GL_TEXTURE_2D;
}
virtual GLenum GetTextureTarget() const MOZ_OVERRIDE { return LOCAL_GL_TEXTURE_2D; }
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
virtual GLenum GetWrapMode() const MOZ_OVERRIDE {
return LOCAL_GL_CLAMP_TO_EDGE;
}
virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return LOCAL_GL_CLAMP_TO_EDGE; }
virtual void DeallocateDeviceData() MOZ_OVERRIDE;
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
gl::GLContext* gl() const;
static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType);
protected: