/src/mozilla-central/gfx/layers/ShareableCanvasRenderer.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 GFX_SHAREABLECANVASRENDERER_H |
8 | | #define GFX_SHAREABLECANVASRENDERER_H |
9 | | |
10 | | #include "CompositorTypes.h" |
11 | | #include "CopyableCanvasRenderer.h" |
12 | | #include "mozilla/layers/CanvasClient.h" |
13 | | |
14 | | namespace mozilla { |
15 | | namespace gl { |
16 | | class SurfaceFactory; |
17 | | } // namespace gl |
18 | | |
19 | | namespace gfx { |
20 | | class DrawTarget; |
21 | | } // namespace gfx |
22 | | |
23 | | namespace layers { |
24 | | |
25 | | class ShareableCanvasRenderer : public CopyableCanvasRenderer |
26 | | { |
27 | | typedef CanvasClient::CanvasClientType CanvasClientType; |
28 | | public: |
29 | | ShareableCanvasRenderer(); |
30 | | virtual ~ShareableCanvasRenderer(); |
31 | | |
32 | | public: |
33 | | void Initialize(const CanvasInitializeData& aData) override; |
34 | | |
35 | | virtual CompositableForwarder* GetForwarder() = 0; |
36 | | |
37 | | virtual bool CreateCompositable() = 0; |
38 | | |
39 | | void ClearCachedResources() override; |
40 | | void Destroy() override; |
41 | | |
42 | | void UpdateCompositableClient(); |
43 | | |
44 | 0 | const TextureFlags& Flags() const { return mFlags; } |
45 | | |
46 | 0 | CanvasClient* GetCanvasClient() { return mCanvasClient; } |
47 | | |
48 | | protected: |
49 | | bool UpdateTarget(gfx::DrawTarget* aDestTarget); |
50 | | |
51 | | CanvasClientType GetCanvasClientType(); |
52 | | |
53 | | RefPtr<CanvasClient> mCanvasClient; |
54 | | |
55 | | UniquePtr<gl::SurfaceFactory> mFactory; |
56 | | |
57 | | TextureFlags mFlags; |
58 | | |
59 | | friend class CanvasClient2D; |
60 | | friend class CanvasClientSharedSurface; |
61 | | }; |
62 | | |
63 | | } // namespace layers |
64 | | } // namespace mozilla |
65 | | |
66 | | #endif |