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

This commit is contained in:
Nicolas Silva 2014-04-04 11:15:47 +08:00
parent 061c466077
commit e195bff1bb
5 changed files with 39 additions and 33 deletions

View File

@ -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) {

View File

@ -7,7 +7,6 @@
#define MOZILLA_GFX_TEXTURECLIENT_X11_H
#include "mozilla/layers/TextureClient.h"
#include "ISurfaceAllocator.h" // For IsSurfaceDescriptorValid
#include "mozilla/layers/ShadowLayerUtilsX11.h"
namespace mozilla {
@ -16,30 +15,32 @@ namespace layers {
/**
* A TextureClient implementation based on Xlib.
*/
class TextureClientX11
: public TextureClient
class TextureClientX11 : public TextureClient
{
public:
TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
~TextureClientX11();
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;
bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags flags) MOZ_OVERRIDE;
virtual TextureClientData* DropTextureData() MOZ_OVERRIDE;
TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
gfx::SurfaceFormat GetFormat() const {
return mFormat;
}
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
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 TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
virtual gfx::SurfaceFormat GetFormat() const { return mFormat; }
virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return false; }

View File

@ -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 { }

View File

@ -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

View File

@ -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: