Bug 1891710: part 2) Enable <Element-outerHTML.html> WPT for Trusted Types. r=smaug
[gecko.git] / gfx / layers / composite / GPUVideoTextureHost.h
blobb4f6cc249ea6544ec83db5c21f309245813cb191
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_GPUVIDEOTEXTUREHOST_H
8 #define MOZILLA_GFX_GPUVIDEOTEXTUREHOST_H
10 #include "mozilla/layers/TextureHost.h"
12 namespace mozilla {
13 namespace layers {
15 class GPUVideoTextureHost : public TextureHost {
16 public:
17 static GPUVideoTextureHost* CreateFromDescriptor(
18 const dom::ContentParentId& aContentId, TextureFlags aFlags,
19 const SurfaceDescriptorGPUVideo& aDescriptor);
21 virtual ~GPUVideoTextureHost();
23 void DeallocateDeviceData() override {}
25 gfx::SurfaceFormat GetFormat() const override;
27 already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override {
28 return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
31 gfx::YUVColorSpace GetYUVColorSpace() const override;
32 gfx::ColorDepth GetColorDepth() const override;
33 gfx::ColorRange GetColorRange() const override;
35 gfx::IntSize GetSize() const override;
37 bool IsValid() override;
39 #ifdef MOZ_LAYERS_HAVE_LOG
40 const char* Name() override { return "GPUVideoTextureHost"; }
41 #endif
43 void CreateRenderTexture(
44 const wr::ExternalImageId& aExternalImageId) override;
46 void MaybeDestroyRenderTexture() override;
48 uint32_t NumSubTextures() override;
50 void PushResourceUpdates(wr::TransactionBuilder& aResources,
51 ResourceUpdateOp aOp,
52 const Range<wr::ImageKey>& aImageKeys,
53 const wr::ExternalImageId& aExtID) override;
55 void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
56 const wr::LayoutRect& aBounds,
57 const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
58 const Range<wr::ImageKey>& aImageKeys,
59 PushDisplayItemFlagSet aFlags) override;
61 bool SupportsExternalCompositing(WebRenderBackend aBackend) override;
63 void UnbindTextureSource() override;
65 void NotifyNotUsed() override;
67 BufferTextureHost* AsBufferTextureHost() override;
69 bool IsWrappingSurfaceTextureHost() override;
71 TextureHostType GetTextureHostType() override;
73 bool NeedsDeferredDeletion() const override;
75 const dom::ContentParentId& GetContentId() const { return mContentId; }
77 protected:
78 GPUVideoTextureHost(const dom::ContentParentId& aContentId,
79 TextureFlags aFlags,
80 const SurfaceDescriptorGPUVideo& aDescriptor);
82 TextureHost* EnsureWrappedTextureHost();
84 RefPtr<TextureHost> mWrappedTextureHost;
85 dom::ContentParentId mContentId;
86 SurfaceDescriptorGPUVideo mDescriptor;
89 } // namespace layers
90 } // namespace mozilla
92 #endif // MOZILLA_GFX_GPUVIDEOTEXTUREHOST_H