Bug 1699062 - Flatten toolkit/themes/*/global/alerts/. r=desktop-theme-reviewers,dao
[gecko.git] / gfx / webrender_bindings / RenderSharedSurfaceTextureHost.h
blob8524cff49ba51830bdf3c9cb8330f1d1df32d1bd
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 MOZILLA_GFX_RENDERSHAREDSURFACETEXTUREHOST_H
8 #define MOZILLA_GFX_RENDERSHAREDSURFACETEXTUREHOST_H
10 #include "RenderTextureHostSWGL.h"
12 namespace mozilla {
13 namespace gfx {
14 class SourceSurfaceSharedDataWrapper;
17 namespace wr {
19 /**
20 * This class allows for surfaces managed by SharedSurfacesParent to be inserted
21 * into the render texture cache by wrapping an existing surface wrapper. These
22 * surfaces are backed by BGRA/X shared memory buffers.
24 class RenderSharedSurfaceTextureHost final : public RenderTextureHostSWGL {
25 public:
26 explicit RenderSharedSurfaceTextureHost(
27 gfx::SourceSurfaceSharedDataWrapper* aSurface);
29 // RenderTextureHost
30 wr::WrExternalImage Lock(uint8_t aChannelIndex, gl::GLContext* aGL,
31 wr::ImageRendering aRendering) override;
32 void Unlock() override;
33 size_t Bytes() override;
35 // RenderTextureHostSWGL
36 size_t GetPlaneCount() const override;
38 gfx::SurfaceFormat GetFormat() const override;
40 gfx::ColorDepth GetColorDepth() const override;
42 bool MapPlane(RenderCompositor* aCompositor, uint8_t aChannelIndex,
43 PlaneInfo& aPlaneInfo) override;
45 void UnmapPlanes() override;
47 private:
48 virtual ~RenderSharedSurfaceTextureHost();
50 RefPtr<gfx::SourceSurfaceSharedDataWrapper> mSurface;
51 gfx::DataSourceSurface::MappedSurface mMap;
52 bool mLocked;
55 } // namespace wr
56 } // namespace mozilla
58 #endif // MOZILLA_GFX_RENDERSHAREDSURFACETEXTUREHOST_H