diff --git a/gfx/layers/basic/TextureClientX11.cpp b/gfx/layers/basic/TextureClientX11.cpp index d1975149d01..8fe309f3455 100644 --- a/gfx/layers/basic/TextureClientX11.cpp +++ b/gfx/layers/basic/TextureClientX11.cpp @@ -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) { diff --git a/gfx/layers/basic/TextureClientX11.h b/gfx/layers/basic/TextureClientX11.h index 3703d07eaa3..6af54ff42c2 100644 --- a/gfx/layers/basic/TextureClientX11.h +++ b/gfx/layers/basic/TextureClientX11.h @@ -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 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 GetAsDrawTarget() MOZ_OVERRIDE; + + virtual gfx::SurfaceFormat GetFormat() const { return mFormat; } virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return false; } diff --git a/gfx/layers/basic/X11TextureSourceBasic.h b/gfx/layers/basic/X11TextureSourceBasic.h index 45916648587..c578df5a4ff 100644 --- a/gfx/layers/basic/X11TextureSourceBasic.h +++ b/gfx/layers/basic/X11TextureSourceBasic.h @@ -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 { } diff --git a/gfx/layers/composite/X11TextureHost.h b/gfx/layers/composite/X11TextureHost.h index 68e8d9a8310..352a09f91f4 100644 --- a/gfx/layers/composite/X11TextureHost.h +++ b/gfx/layers/composite/X11TextureHost.h @@ -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 diff --git a/gfx/layers/opengl/X11TextureSourceOGL.h b/gfx/layers/opengl/X11TextureSourceOGL.h index 7fe0ff605ce..5032b2c48ae 100644 --- a/gfx/layers/opengl/X11TextureSourceOGL.h +++ b/gfx/layers/opengl/X11TextureSourceOGL.h @@ -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: