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
,
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
;
48 virtual ~RenderSharedSurfaceTextureHost();
50 RefPtr
<gfx::SourceSurfaceSharedDataWrapper
> mSurface
;
51 gfx::DataSourceSurface::MappedSurface mMap
;
56 } // namespace mozilla
58 #endif // MOZILLA_GFX_RENDERSHAREDSURFACETEXTUREHOST_H