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/. */
7 #ifndef GFX_SHAREABLECANVASRENDERER_H
8 #define GFX_SHAREABLECANVASRENDERER_H
10 #include "CompositorTypes.h"
11 #include "CopyableCanvasRenderer.h"
12 #include "mozilla/layers/CanvasClient.h"
25 class ShareableCanvasRenderer
: public CopyableCanvasRenderer
{
26 typedef CanvasClient::CanvasClientType CanvasClientType
;
29 ShareableCanvasRenderer();
30 virtual ~ShareableCanvasRenderer();
33 void Initialize(const CanvasInitializeData
& aData
) override
;
35 virtual CompositableForwarder
* GetForwarder() = 0;
37 virtual bool CreateCompositable() = 0;
39 void ClearCachedResources() override
;
40 void Destroy() override
;
42 void UpdateCompositableClient(
43 wr::RenderRoot aRenderRoot
= wr::RenderRoot::Default
);
45 const TextureFlags
& Flags() const { return mFlags
; }
47 CanvasClient
* GetCanvasClient() { return mCanvasClient
; }
50 bool UpdateTarget(gfx::DrawTarget
* aDestTarget
);
52 CanvasClientType
GetCanvasClientType();
54 RefPtr
<CanvasClient
> mCanvasClient
;
56 UniquePtr
<gl::SurfaceFactory
> mFactory
;
60 friend class CanvasClient2D
;
61 friend class CanvasClientSharedSurface
;
65 } // namespace mozilla