Line data Source code
1 : /* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef SHARED_SURFACE_GLX_H_
7 : #define SHARED_SURFACE_GLX_H_
8 :
9 : #include "SharedSurface.h"
10 : #include "mozilla/RefPtr.h"
11 :
12 : class gfxXlibSurface;
13 :
14 : namespace mozilla {
15 : namespace gl {
16 :
17 0 : class SharedSurface_GLXDrawable
18 : : public SharedSurface
19 : {
20 : public:
21 : static UniquePtr<SharedSurface_GLXDrawable> Create(GLContext* prodGL,
22 : const SurfaceCaps& caps,
23 : const gfx::IntSize& size,
24 : bool deallocateClient,
25 : bool inSameProcess);
26 :
27 0 : virtual void ProducerAcquireImpl() override {}
28 : virtual void ProducerReleaseImpl() override;
29 :
30 : virtual void LockProdImpl() override;
31 : virtual void UnlockProdImpl() override;
32 :
33 : virtual bool ToSurfaceDescriptor(layers::SurfaceDescriptor* const out_descriptor) override;
34 :
35 : virtual bool ReadbackBySharedHandle(gfx::DataSourceSurface* out_surface) override;
36 : private:
37 : SharedSurface_GLXDrawable(GLContext* gl,
38 : const gfx::IntSize& size,
39 : bool inSameProcess,
40 : const RefPtr<gfxXlibSurface>& xlibSurface);
41 :
42 : RefPtr<gfxXlibSurface> mXlibSurface;
43 : bool mInSameProcess;
44 : };
45 :
46 0 : class SurfaceFactory_GLXDrawable
47 : : public SurfaceFactory
48 : {
49 : public:
50 : static UniquePtr<SurfaceFactory_GLXDrawable> Create(GLContext* prodGL,
51 : const SurfaceCaps& caps,
52 : const RefPtr<layers::LayersIPCChannel>& allocator,
53 : const layers::TextureFlags& flags);
54 :
55 : virtual UniquePtr<SharedSurface> CreateShared(const gfx::IntSize& size) override;
56 :
57 : private:
58 0 : SurfaceFactory_GLXDrawable(GLContext* prodGL, const SurfaceCaps& caps,
59 : const RefPtr<layers::LayersIPCChannel>& allocator,
60 : const layers::TextureFlags& flags)
61 0 : : SurfaceFactory(SharedSurfaceType::GLXDrawable, prodGL, caps, allocator, flags)
62 0 : { }
63 : };
64 :
65 : } // namespace gl
66 : } // namespace mozilla
67 :
68 : #endif // SHARED_SURFACE_GLX_H_
|