Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/layers/wr/WebRenderImageHost.h
Line
Count
Source (jump to first uncovered line)
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/. */
6
7
#ifndef MOZILLA_GFX_WEBRENDERIMAGEHOST_H
8
#define MOZILLA_GFX_WEBRENDERIMAGEHOST_H
9
10
#include "CompositableHost.h"           // for CompositableHost
11
#include "mozilla/layers/ImageComposite.h"  // for ImageComposite
12
13
namespace mozilla {
14
namespace layers {
15
16
class WebRenderBridgeParent;
17
18
/**
19
 * ImageHost. Works with ImageClientSingle and ImageClientBuffered
20
 */
21
class WebRenderImageHost : public CompositableHost,
22
                           public ImageComposite
23
{
24
public:
25
  explicit WebRenderImageHost(const TextureInfo& aTextureInfo);
26
  ~WebRenderImageHost();
27
28
0
  virtual CompositableType GetType() override { return mTextureInfo.mCompositableType; }
29
30
  virtual void Composite(Compositor* aCompositor,
31
                         LayerComposite* aLayer,
32
                         EffectChain& aEffectChain,
33
                         float aOpacity,
34
                         const gfx::Matrix4x4& aTransform,
35
                         const gfx::SamplingFilter aSamplingFilter,
36
                         const gfx::IntRect& aClipRect,
37
                         const nsIntRegion* aVisibleRegion = nullptr,
38
                         const Maybe<gfx::Polygon>& aGeometry = Nothing()) override;
39
40
  virtual void UseTextureHost(const nsTArray<TimedTexture>& aTextures) override;
41
  virtual void UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
42
                                         TextureHost* aTextureOnWhite) override;
43
  virtual void RemoveTextureHost(TextureHost* aTexture) override;
44
45
  virtual TextureHost* GetAsTextureHost(gfx::IntRect* aPictureRect = nullptr) override;
46
47
  virtual void Attach(Layer* aLayer,
48
                      TextureSourceProvider* aProvider,
49
                      AttachFlags aFlags = NO_FLAGS) override;
50
51
  virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override;
52
53
  gfx::IntSize GetImageSize() override;
54
55
  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
56
57
  virtual void Dump(std::stringstream& aStream,
58
                    const char* aPrefix = "",
59
                    bool aDumpHtml = false) override;
60
61
  virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;
62
63
  virtual bool Lock() override;
64
65
  virtual void Unlock() override;
66
67
  virtual void CleanupResources() override;
68
69
  uint32_t GetDroppedFrames() override
70
0
  {
71
0
    return GetDroppedFramesAndReset();
72
0
  }
73
74
0
  virtual WebRenderImageHost* AsWebRenderImageHost() override { return this; }
75
76
  TextureHost* GetAsTextureHostForComposite();
77
78
  void SetWrBridge(WebRenderBridgeParent* aWrBridge);
79
80
  void ClearWrBridge();
81
82
  void EnableUseAsyncImagePipeline()
83
0
  {
84
0
    mUseAsyncImagePipeline = true;
85
0
  }
86
87
  TextureHost* GetCurrentTextureHost() { return mCurrentTextureHost; }
88
89
protected:
90
  // ImageComposite
91
  virtual TimeStamp GetCompositionTime() const override;
92
93
  void SetCurrentTextureHost(TextureHost* aTexture);
94
95
  WebRenderBridgeParent* MOZ_NON_OWNING_REF mWrBridge;
96
97
  uint32_t mWrBridgeBindings;
98
  bool mUseAsyncImagePipeline;
99
100
  CompositableTextureHostRef mCurrentTextureHost;
101
};
102
103
} // namespace layers
104
} // namespace mozilla
105
106
#endif // MOZILLA_GFX_WEBRENDERIMAGEHOST_H