Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; 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 GFX_SHAREABLECANVASLAYER_H
7 : #define GFX_SHAREABLECANVASLAYER_H
8 :
9 : #include "CompositorTypes.h"
10 : #include "CopyableCanvasLayer.h"
11 : #include "mozilla/layers/CanvasClient.h"
12 :
13 : namespace mozilla {
14 : namespace gl {
15 : class SurfaceFactory;
16 : } // namespace gl
17 :
18 : namespace layers {
19 :
20 : class ShareableCanvasLayer : public CopyableCanvasLayer
21 : {
22 : typedef CanvasClient::CanvasClientType CanvasClientType;
23 : public:
24 : ShareableCanvasLayer(LayerManager* aLayerManager, void *aImplData);
25 :
26 : protected:
27 : virtual ~ShareableCanvasLayer();
28 :
29 : public:
30 : virtual void Initialize(const Data& aData) override;
31 :
32 : virtual CompositableForwarder* GetForwarder() = 0;
33 :
34 : virtual void AttachCompositable() = 0;
35 :
36 : void UpdateCompositableClient();
37 :
38 0 : const TextureFlags& Flags() const { return mFlags; }
39 :
40 : protected:
41 :
42 : bool UpdateTarget(gfx::DrawTarget* aDestTarget = nullptr);
43 :
44 : CanvasClientType GetCanvasClientType();
45 :
46 : RefPtr<CanvasClient> mCanvasClient;
47 :
48 : UniquePtr<gl::SurfaceFactory> mFactory;
49 :
50 : TextureFlags mFlags;
51 :
52 : friend class CanvasClient2D;
53 : friend class CanvasClientSharedSurface;
54 : };
55 :
56 : } // namespace layers
57 : } // namespace mozilla
58 :
59 : #endif
|