Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/layers/composite/CanvasLayerComposite.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 GFX_CanvasLayerComposite_H
8
#define GFX_CanvasLayerComposite_H
9
10
#include "Layers.h"                     // for CanvasLayer, etc
11
#include "mozilla/Attributes.h"         // for override
12
#include "mozilla/RefPtr.h"             // for RefPtr
13
#include "mozilla/layers/LayerManagerComposite.h"  // for LayerComposite, etc
14
#include "mozilla/layers/LayersTypes.h"  // for LayerRenderState, etc
15
#include "nsRect.h"                     // for mozilla::gfx::IntRect
16
#include "nscore.h"                     // for nsACString
17
18
namespace mozilla {
19
namespace layers {
20
21
class CompositableHost;
22
// Canvas layers use ImageHosts (but CanvasClients) because compositing a
23
// canvas is identical to compositing an image.
24
class ImageHost;
25
26
class CanvasLayerComposite : public CanvasLayer,
27
                             public LayerComposite
28
{
29
public:
30
  explicit CanvasLayerComposite(LayerManagerComposite* aManager);
31
32
protected:
33
  virtual ~CanvasLayerComposite();
34
35
public:
36
  virtual bool SetCompositableHost(CompositableHost* aHost) override;
37
38
  virtual void Disconnect() override
39
0
  {
40
0
    Destroy();
41
0
  }
42
43
  virtual void SetLayerManager(HostLayerManager* aManager) override;
44
45
  virtual Layer* GetLayer() override;
46
  virtual void RenderLayer(const gfx::IntRect& aClipRect,
47
                           const Maybe<gfx::Polygon>& aGeometry) override;
48
49
  virtual void CleanupResources() override;
50
51
  virtual void GenEffectChain(EffectChain& aEffect) override;
52
53
  CompositableHost* GetCompositableHost() override;
54
55
0
  virtual HostLayer* AsHostLayer() override { return this; }
56
57
0
  virtual const char* Name() const override { return "CanvasLayerComposite"; }
58
59
protected:
60
0
  CanvasRenderer* CreateCanvasRendererInternal() override {
61
0
    MOZ_CRASH("Incompatible surface type");
62
0
    return nullptr;
63
0
  }
64
65
  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
66
67
private:
68
  gfx::SamplingFilter GetSamplingFilter();
69
70
private:
71
  RefPtr<CompositableHost> mCompositableHost;
72
};
73
74
} // namespace layers
75
} // namespace mozilla
76
77
#endif /* GFX_CanvasLayerComposite_H */