Bug 1874684 - Part 28: Return DateDuration from DifferenceISODateTime. r=mgaudet
[gecko.git] / gfx / webrender_bindings / RenderSharedSurfaceTextureHost.h
blob2575abdac31afbe48c29cf5b61479bef9dc812f8
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) override;
31 void Unlock() override;
32 size_t Bytes() override;
34 // RenderTextureHostSWGL
35 size_t GetPlaneCount() const override;
37 gfx::SurfaceFormat GetFormat() const override;
39 gfx::ColorDepth GetColorDepth() const override;
41 bool MapPlane(RenderCompositor* aCompositor, uint8_t aChannelIndex,
42 PlaneInfo& aPlaneInfo) override;
44 void UnmapPlanes() override;
46 private:
47 virtual ~RenderSharedSurfaceTextureHost();
49 RefPtr<gfx::SourceSurfaceSharedDataWrapper> mSurface;
50 gfx::DataSourceSurface::MappedSurface mMap;
51 bool mLocked;
54 } // namespace wr
55 } // namespace mozilla
57 #endif // MOZILLA_GFX_RENDERSHAREDSURFACETEXTUREHOST_H