2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2016-12-28 05:16:43 +03:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2017-08-03 08:55:14 +03:00
|
|
|
#ifndef GFX_SHAREABLECANVASRENDERER_H
|
|
|
|
#define GFX_SHAREABLECANVASRENDERER_H
|
2016-12-28 05:16:43 +03:00
|
|
|
|
|
|
|
#include "CompositorTypes.h"
|
2017-08-03 08:55:14 +03:00
|
|
|
#include "CopyableCanvasRenderer.h"
|
2016-12-28 05:16:43 +03:00
|
|
|
#include "mozilla/layers/CanvasClient.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gl {
|
|
|
|
class SurfaceFactory;
|
|
|
|
} // namespace gl
|
|
|
|
|
2018-08-10 18:15:23 +03:00
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
|
|
|
} // namespace gfx
|
|
|
|
|
2016-12-28 05:16:43 +03:00
|
|
|
namespace layers {
|
|
|
|
|
2017-08-03 08:55:14 +03:00
|
|
|
class ShareableCanvasRenderer : public CopyableCanvasRenderer {
|
2016-12-28 05:16:43 +03:00
|
|
|
typedef CanvasClient::CanvasClientType CanvasClientType;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-12-28 05:16:43 +03:00
|
|
|
public:
|
2017-08-03 08:55:14 +03:00
|
|
|
ShareableCanvasRenderer();
|
|
|
|
virtual ~ShareableCanvasRenderer();
|
2016-12-28 05:16:43 +03:00
|
|
|
|
|
|
|
public:
|
2017-08-03 08:55:14 +03:00
|
|
|
void Initialize(const CanvasInitializeData& aData) override;
|
2016-12-28 05:16:43 +03:00
|
|
|
|
|
|
|
virtual CompositableForwarder* GetForwarder() = 0;
|
|
|
|
|
2017-08-03 08:55:14 +03:00
|
|
|
virtual bool CreateCompositable() = 0;
|
|
|
|
|
|
|
|
void ClearCachedResources() override;
|
|
|
|
void Destroy() override;
|
2016-12-28 05:16:43 +03:00
|
|
|
|
2019-03-22 21:28:42 +03:00
|
|
|
void UpdateCompositableClient(
|
|
|
|
wr::RenderRoot aRenderRoot = wr::RenderRoot::Default);
|
2016-12-28 05:16:43 +03:00
|
|
|
|
|
|
|
const TextureFlags& Flags() const { return mFlags; }
|
|
|
|
|
2017-08-03 08:55:14 +03:00
|
|
|
CanvasClient* GetCanvasClient() { return mCanvasClient; }
|
2016-12-28 05:16:43 +03:00
|
|
|
|
2017-08-03 08:55:14 +03:00
|
|
|
protected:
|
|
|
|
bool UpdateTarget(gfx::DrawTarget* aDestTarget);
|
2016-12-28 05:16:43 +03:00
|
|
|
|
|
|
|
CanvasClientType GetCanvasClientType();
|
|
|
|
|
|
|
|
RefPtr<CanvasClient> mCanvasClient;
|
|
|
|
|
|
|
|
UniquePtr<gl::SurfaceFactory> mFactory;
|
|
|
|
|
|
|
|
TextureFlags mFlags;
|
|
|
|
|
|
|
|
friend class CanvasClient2D;
|
|
|
|
friend class CanvasClientSharedSurface;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|