2014-02-18 04:30:05 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef MOZILLA_GFX_X11TEXTUREHOST__H
|
|
|
|
#define MOZILLA_GFX_X11TEXTUREHOST__H
|
|
|
|
|
|
|
|
#include "mozilla/layers/TextureHost.h"
|
|
|
|
#include "mozilla/layers/LayersSurfaces.h"
|
2014-04-11 18:15:01 +04:00
|
|
|
#include "mozilla/gfx/Types.h"
|
2014-02-18 04:30:05 +04:00
|
|
|
|
2014-07-22 19:29:33 +04:00
|
|
|
#include "gfxXlibSurface.h"
|
2014-02-18 04:30:05 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2015-08-27 06:41:07 +03:00
|
|
|
class X11TextureSource : public TextureSource
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Called when the underlying X surface has been changed.
|
|
|
|
// Useful for determining whether to rebind a GLXPixmap to a texture.
|
|
|
|
virtual void Updated() = 0;
|
|
|
|
};
|
|
|
|
|
2014-04-11 18:15:01 +04:00
|
|
|
// TextureHost for Xlib-backed TextureSources.
|
2014-02-18 04:30:05 +04:00
|
|
|
class X11TextureHost : public TextureHost
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
X11TextureHost(TextureFlags aFlags,
|
|
|
|
const SurfaceDescriptorX11& aDescriptor);
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetCompositor(Compositor* aCompositor) override;
|
2014-04-11 18:15:01 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool Lock() override;
|
2014-04-11 18:15:01 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::SurfaceFormat GetFormat() const override;
|
2014-04-11 18:15:01 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::IntSize GetSize() const override;
|
2014-02-18 04:30:05 +04:00
|
|
|
|
2015-03-27 13:16:34 +03:00
|
|
|
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override
|
2014-02-18 04:30:05 +04:00
|
|
|
{
|
2015-03-27 13:16:34 +03:00
|
|
|
aTexture = mTextureSource;
|
|
|
|
return !!aTexture;
|
2014-02-18 04:30:05 +04:00
|
|
|
}
|
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;
|
2014-02-18 04:30:05 +04:00
|
|
|
|
|
|
|
#ifdef MOZ_LAYERS_HAVE_LOG
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual const char* Name() override { return "X11TextureHost"; }
|
2014-02-18 04:30:05 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
2015-08-27 06:41:07 +03:00
|
|
|
virtual void UpdatedInternal(const nsIntRegion*) override
|
|
|
|
{
|
|
|
|
if (mTextureSource)
|
|
|
|
mTextureSource->Updated();
|
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<Compositor> mCompositor;
|
|
|
|
RefPtr<X11TextureSource> mTextureSource;
|
|
|
|
RefPtr<gfxXlibSurface> mSurface;
|
2014-02-18 04:30:05 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // MOZILLA_GFX_X11TEXTUREHOST__H
|