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"
14 class SourceSurfaceSharedDataWrapper
;
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
{
26 explicit RenderSharedSurfaceTextureHost(
27 gfx::SourceSurfaceSharedDataWrapper
* aSurface
);
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
;
47 virtual ~RenderSharedSurfaceTextureHost();
49 RefPtr
<gfx::SourceSurfaceSharedDataWrapper
> mSurface
;
50 gfx::DataSourceSurface::MappedSurface mMap
;
55 } // namespace mozilla
57 #endif // MOZILLA_GFX_RENDERSHAREDSURFACETEXTUREHOST_H