Source code

Revision control

Other Tools

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
typedef CanvasClient::CanvasClientType CanvasClientType;
27
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
wr::RenderRoot aRenderRoot = wr::RenderRoot::Default);
44
45
const TextureFlags& Flags() const { return mFlags; }
46
47
CanvasClient* GetCanvasClient() { return mCanvasClient; }
48
49
protected:
50
bool UpdateTarget(gfx::DrawTarget* aDestTarget);
51
52
CanvasClientType GetCanvasClientType();
53
54
RefPtr<CanvasClient> mCanvasClient;
55
56
UniquePtr<gl::SurfaceFactory> mFactory;
57
58
TextureFlags mFlags;
59
60
friend class CanvasClient2D;
61
friend class CanvasClientSharedSurface;
62
};
63
64
} // namespace layers
65
} // namespace mozilla
66
67
#endif