Bug 1685225 - Use state bits to determine the color for non-native theme meter chunks...
[gecko.git] / gfx / webrender_bindings / RenderTextureHostWrapper.h
blobcce0694bc6638111fc2df961d87d498d09964ac3
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_RENDERTEXTUREHOSTWRAPPER_H
8 #define MOZILLA_GFX_RENDERTEXTUREHOSTWRAPPER_H
10 #include "RenderTextureHostSWGL.h"
12 namespace mozilla {
14 namespace wr {
16 /**
17 * RenderTextureHost of GPUVideoTextureHost.
19 * GPUVideoTextureHost wraps TextureHost. This class wraps RenderTextureHost of
20 * the wrapped TextureHost. Lifetime of the wrapped TextureHost is usually
21 * longer than GPUVideoTextureHost and the wrapped TextureHost is used by
22 * multiple GPUVideoTextureHosts. This class is used to reduce recreations of
23 * the wrappded RenderTextureHost. Initializations of some
24 * RenderTextureHosts(RenderDXGITextureHost and
25 * RenderDXGIYCbCrTextureHost) have overhead.
27 class RenderTextureHostWrapper final : public RenderTextureHostSWGL {
28 public:
29 explicit RenderTextureHostWrapper(ExternalImageId aExternalImageId);
31 // RenderTextureHost
32 wr::WrExternalImage Lock(uint8_t aChannelIndex, gl::GLContext* aGL,
33 wr::ImageRendering aRendering) override;
34 void Unlock() override;
35 void ClearCachedResources() override;
36 RenderMacIOSurfaceTextureHost* AsRenderMacIOSurfaceTextureHost() override;
37 RenderDXGITextureHost* AsRenderDXGITextureHost() override;
38 RenderDXGIYCbCrTextureHost* AsRenderDXGIYCbCrTextureHost() override;
40 // RenderTextureHostSWGL
41 size_t GetPlaneCount() const override;
42 gfx::SurfaceFormat GetFormat() const override;
43 gfx::ColorDepth GetColorDepth() const override;
44 gfx::YUVColorSpace GetYUVColorSpace() const override;
45 bool MapPlane(RenderCompositor* aCompositor, uint8_t aChannelIndex,
46 PlaneInfo& aPlaneInfo) override;
47 void UnmapPlanes() override;
49 private:
50 ~RenderTextureHostWrapper() override;
52 void EnsureTextureHost() const;
53 RenderTextureHostSWGL* EnsureRenderTextureHostSWGL() const;
55 const ExternalImageId mExternalImageId;
56 mutable RefPtr<RenderTextureHost> mTextureHost;
59 } // namespace wr
60 } // namespace mozilla
62 #endif // MOZILLA_GFX_RENDERTEXTUREHOSTWRAPPER_H