Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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 MOZILLA_GFX_X11BASICCOMPOSITOR_H
7 : #define MOZILLA_GFX_X11BASICCOMPOSITOR_H
8 :
9 : #include "mozilla/layers/BasicCompositor.h"
10 : #include "mozilla/layers/X11TextureSourceBasic.h"
11 : #include "mozilla/layers/TextureHostBasic.h"
12 : #include "gfxXlibSurface.h"
13 : #include "mozilla/gfx/2D.h"
14 :
15 : namespace mozilla {
16 : namespace layers {
17 :
18 : // TextureSource for Image-backed surfaces.
19 0 : class X11DataTextureSourceBasic : public DataTextureSource
20 : , public TextureSourceBasic
21 : {
22 : public:
23 0 : X11DataTextureSourceBasic() {};
24 :
25 0 : virtual const char* Name() const override { return "X11DataTextureSourceBasic"; }
26 :
27 : virtual bool Update(gfx::DataSourceSurface* aSurface,
28 : nsIntRegion* aDestRegion = nullptr,
29 : gfx::IntPoint* aSrcOffset = nullptr) override;
30 :
31 : virtual TextureSourceBasic* AsSourceBasic() override;
32 :
33 : virtual gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) override;
34 :
35 : virtual void DeallocateDeviceData() override;
36 :
37 : virtual gfx::IntSize GetSize() const override;
38 :
39 : virtual gfx::SurfaceFormat GetFormat() const override;
40 :
41 : private:
42 : // We are going to buffer layer content on this xlib draw target
43 : RefPtr<mozilla::gfx::DrawTarget> mBufferDrawTarget;
44 : };
45 :
46 0 : class X11BasicCompositor : public BasicCompositor
47 : {
48 : public:
49 0 : explicit X11BasicCompositor(CompositorBridgeParent* aParent, widget::CompositorWidget* aWidget)
50 0 : : BasicCompositor(aParent, aWidget)
51 0 : {}
52 :
53 : virtual already_AddRefed<DataTextureSource>
54 : CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) override;
55 :
56 : virtual already_AddRefed<DataTextureSource>
57 0 : CreateDataTextureSourceAround(gfx::DataSourceSurface* aSurface) override { return nullptr; }
58 :
59 : virtual void EndFrame() override;
60 : };
61 :
62 : } // namespace layers
63 : } // namespace mozilla
64 :
65 : #endif /* MOZILLA_GFX_X11BASICCOMPOSITOR_H */
|