/work/obj-fuzz/dist/include/mozilla/layers/X11TextureHost.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef MOZILLA_GFX_X11TEXTUREHOST__H |
8 | | #define MOZILLA_GFX_X11TEXTUREHOST__H |
9 | | |
10 | | #include "mozilla/layers/TextureHost.h" |
11 | | #include "mozilla/layers/LayersSurfaces.h" |
12 | | #include "mozilla/gfx/Types.h" |
13 | | |
14 | | #include "gfxXlibSurface.h" |
15 | | |
16 | | namespace mozilla { |
17 | | namespace layers { |
18 | | |
19 | | class X11TextureSource : public TextureSource |
20 | | { |
21 | | public: |
22 | | // Called when the underlying X surface has been changed. |
23 | | // Useful for determining whether to rebind a GLXPixmap to a texture. |
24 | | virtual void Updated() = 0; |
25 | | |
26 | 0 | virtual const char* Name() const override { return "X11TextureSource"; } |
27 | | }; |
28 | | |
29 | | // TextureHost for Xlib-backed TextureSources. |
30 | | class X11TextureHost : public TextureHost |
31 | | { |
32 | | public: |
33 | | X11TextureHost(TextureFlags aFlags, |
34 | | const SurfaceDescriptorX11& aDescriptor); |
35 | | |
36 | | virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; |
37 | | |
38 | | virtual bool Lock() override; |
39 | | |
40 | | virtual gfx::SurfaceFormat GetFormat() const override; |
41 | | |
42 | | virtual gfx::IntSize GetSize() const override; |
43 | | |
44 | | virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override |
45 | 0 | { |
46 | 0 | aTexture = mTextureSource; |
47 | 0 | return !!aTexture; |
48 | 0 | } |
49 | | |
50 | | virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override; |
51 | | |
52 | | #ifdef MOZ_LAYERS_HAVE_LOG |
53 | 0 | virtual const char* Name() override { return "X11TextureHost"; } |
54 | | #endif |
55 | | |
56 | | protected: |
57 | | virtual void UpdatedInternal(const nsIntRegion*) override |
58 | 0 | { |
59 | 0 | if (mTextureSource) |
60 | 0 | mTextureSource->Updated(); |
61 | 0 | } |
62 | | |
63 | | RefPtr<Compositor> mCompositor; |
64 | | RefPtr<X11TextureSource> mTextureSource; |
65 | | RefPtr<gfxXlibSurface> mSurface; |
66 | | }; |
67 | | |
68 | | } // namespace layers |
69 | | } // namespace mozilla |
70 | | |
71 | | #endif // MOZILLA_GFX_X11TEXTUREHOST__H |