LCOV - code coverage report
Current view: top level - gfx/layers/wr - WebRenderTextureHost.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 4 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          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_WEBRENDERTEXTUREHOST_H
       7             : #define MOZILLA_GFX_WEBRENDERTEXTUREHOST_H
       8             : 
       9             : #include "mozilla/layers/TextureHost.h"
      10             : #include "mozilla/webrender/WebRenderTypes.h"
      11             : 
      12             : namespace mozilla {
      13             : namespace layers {
      14             : 
      15             : class SurfaceDescriptor;
      16             : 
      17             : // This textureHost is specialized for WebRender usage. With WebRender, there is
      18             : // no Compositor during composition. Instead, we use RendererOGL for composition.
      19             : // So, there are some UNREACHABLE asserts for the original Compositor related
      20             : // code path in this class. Furthermore, the RendererOGL runs at RenderThead
      21             : // instead of Compositor thread. This class is also creating the corresponding
      22             : // RenderXXXTextureHost used by RendererOGL at RenderThread.
      23             : class WebRenderTextureHost : public TextureHost
      24             : {
      25             : public:
      26             :   WebRenderTextureHost(const SurfaceDescriptor& aDesc,
      27             :                        TextureFlags aFlags,
      28             :                        TextureHost* aTexture,
      29             :                        wr::ExternalImageId& aExternalImageId);
      30             :   virtual ~WebRenderTextureHost();
      31             : 
      32           0 :   virtual void DeallocateDeviceData() override {}
      33             : 
      34             :   virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override;
      35             : 
      36             :   virtual bool Lock() override;
      37             : 
      38             :   virtual void Unlock() override;
      39             : 
      40             :   virtual gfx::SurfaceFormat GetFormat() const override;
      41             : 
      42             :   // Return the format used for reading the texture. Some hardware specific
      43             :   // textureHosts use their special data representation internally, but we could
      44             :   // treat these textureHost as the read-format when we read them.
      45             :   // Please check TextureHost::GetReadFormat().
      46             :   virtual gfx::SurfaceFormat GetReadFormat() const override;
      47             : 
      48             :   virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override;
      49             : 
      50             :   virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;
      51             : 
      52             :   virtual YUVColorSpace GetYUVColorSpace() const override;
      53             : 
      54             :   virtual gfx::IntSize GetSize() const override;
      55             : 
      56             : #ifdef MOZ_LAYERS_HAVE_LOG
      57           0 :   virtual const char* Name() override { return "WebRenderTextureHost"; }
      58             : #endif
      59             : 
      60           0 :   virtual WebRenderTextureHost* AsWebRenderTextureHost() override { return this; }
      61             : 
      62           0 :   wr::ExternalImageId GetExternalImageKey() { return mExternalImageId; }
      63             : 
      64             :   int32_t GetRGBStride();
      65             : 
      66             :   bool IsWrappingNativeHandle() { return mIsWrappingNativeHandle; }
      67             : 
      68             :   virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
      69             :                               const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
      70             : 
      71             :   virtual void AddWRImage(wr::WebRenderAPI* aAPI,
      72             :                           Range<const wr::ImageKey>& aImageKeys,
      73             :                           const wr::ExternalImageId& aExtID) override;
      74             : 
      75             :   virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
      76             :                                  const WrRect& aBounds,
      77             :                                  const WrRect& aClip,
      78             :                                  wr::ImageRendering aFilter,
      79             :                                  Range<const wr::ImageKey>& aImageKeys) override;
      80             : 
      81             : protected:
      82             :   void CreateRenderTextureHost(const SurfaceDescriptor& aDesc, TextureHost* aTexture);
      83             : 
      84             :   RefPtr<TextureHost> mWrappedTextureHost;
      85             :   wr::ExternalImageId mExternalImageId;
      86             : 
      87             :   bool mIsWrappingNativeHandle;
      88             : };
      89             : 
      90             : } // namespace layers
      91             : } // namespace mozilla
      92             : 
      93             : #endif // MOZILLA_GFX_WEBRENDERTEXTUREHOST_H

Generated by: LCOV version 1.13