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_RENDERMACIOSURFACETEXTUREHOST_H
8 #define MOZILLA_GFX_RENDERMACIOSURFACETEXTUREHOST_H
10 #include "mozilla/gfx/MacIOSurface.h"
11 #include "mozilla/layers/TextureHostOGL.h"
12 #include "RenderTextureHostSWGL.h"
17 class SurfaceDescriptorMacIOSurface
;
22 class RenderMacIOSurfaceTextureHost final
: public RenderTextureHostSWGL
{
24 explicit RenderMacIOSurfaceTextureHost(MacIOSurface
* aSurface
);
26 wr::WrExternalImage
Lock(uint8_t aChannelIndex
, gl::GLContext
* aGL
) override
;
27 void Unlock() override
;
29 gfx::IntSize
GetSize(uint8_t aChannelIndex
) const;
30 GLuint
GetGLHandle(uint8_t aChannelIndex
) const;
32 RenderMacIOSurfaceTextureHost
* AsRenderMacIOSurfaceTextureHost() override
{
36 size_t Bytes() override
;
38 MacIOSurface
* GetSurface() { return mSurface
; }
40 // RenderTextureHostSWGL
41 size_t GetPlaneCount() const override
;
42 gfx::SurfaceFormat
GetFormat() const override
;
43 gfx::ColorDepth
GetColorDepth() const override
;
44 gfx::YUVRangedColorSpace
GetYUVColorSpace() const override
;
45 bool MapPlane(RenderCompositor
* aCompositor
, uint8_t aChannelIndex
,
46 PlaneInfo
& aPlaneInfo
) override
;
47 void UnmapPlanes() override
;
50 virtual ~RenderMacIOSurfaceTextureHost();
51 void DeleteTextureHandle();
53 RefPtr
<MacIOSurface
> mSurface
;
54 RefPtr
<gl::GLContext
> mGL
;
55 GLuint mTextureHandles
[3];
59 } // namespace mozilla
61 #endif // MOZILLA_GFX_RENDERMACIOSURFACETEXTUREHOST_H