Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : * This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef MOZILLA_GFX_GPUVIDEOTEXTUREHOST_H
7 : #define MOZILLA_GFX_GPUVIDEOTEXTUREHOST_H
8 :
9 : #include "mozilla/layers/TextureHost.h"
10 :
11 : namespace mozilla {
12 : namespace layers {
13 :
14 : class GPUVideoTextureHost : public TextureHost
15 : {
16 : public:
17 : GPUVideoTextureHost(TextureFlags aFlags,
18 : const SurfaceDescriptorGPUVideo& aDescriptor);
19 : virtual ~GPUVideoTextureHost();
20 :
21 0 : virtual void DeallocateDeviceData() override {}
22 :
23 : virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override;
24 :
25 : virtual bool Lock() override;
26 :
27 : virtual void Unlock() override;
28 :
29 : virtual gfx::SurfaceFormat GetFormat() const override;
30 :
31 : virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override;
32 : virtual bool AcquireTextureSource(CompositableTextureSourceRef& aTexture) override;
33 :
34 0 : virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override
35 : {
36 0 : return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
37 : }
38 :
39 : virtual YUVColorSpace GetYUVColorSpace() const override;
40 :
41 : virtual gfx::IntSize GetSize() const override;
42 :
43 : #ifdef MOZ_LAYERS_HAVE_LOG
44 0 : virtual const char* Name() override { return "GPUVideoTextureHost"; }
45 : #endif
46 :
47 : virtual bool HasIntermediateBuffer() const override;
48 :
49 : virtual void CreateRenderTexture(const wr::ExternalImageId& aExternalImageId) override;
50 :
51 : virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
52 : const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
53 :
54 : virtual void AddWRImage(wr::WebRenderAPI* aAPI,
55 : Range<const wr::ImageKey>& aImageKeys,
56 : const wr::ExternalImageId& aExtID) override;
57 :
58 : virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
59 : const WrRect& aBounds,
60 : const WrRect& aClip,
61 : wr::ImageRendering aFilter,
62 : Range<const wr::ImageKey>& aImageKeys) override;
63 :
64 : protected:
65 : RefPtr<TextureHost> mWrappedTextureHost;
66 : };
67 :
68 : } // namespace layers
69 : } // namespace mozilla
70 :
71 : #endif // MOZILLA_GFX_GPUVIDEOTEXTUREHOST_H
|