Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/layers/LayerTreeInvalidation.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 file,
5
 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef GFX_LAYER_TREE_INVALIDATION_H
8
#define GFX_LAYER_TREE_INVALIDATION_H
9
10
#include "nsRegion.h"                   // for nsIntRegion
11
#include "mozilla/UniquePtr.h"          // for UniquePtr
12
#include "mozilla/gfx/Point.h"
13
14
namespace mozilla {
15
namespace layers {
16
17
class Layer;
18
class ContainerLayer;
19
20
/**
21
 * Callback for ContainerLayer invalidations.
22
 *
23
 * @param aContainer ContainerLayer being invalidated.
24
 * @param aRegion Invalidated region in the ContainerLayer's coordinate
25
 * space. If null, then the entire region must be invalidated.
26
 */
27
typedef void (*NotifySubDocInvalidationFunc)(ContainerLayer* aLayer,
28
                                             const nsIntRegion* aRegion);
29
30
/**
31
 * A set of cached layer properties (including those of child layers),
32
 * used for comparing differences in layer trees.
33
 */
34
struct LayerProperties
35
{
36
protected:
37
0
  LayerProperties() {}
38
39
  LayerProperties(const LayerProperties& a) = delete;
40
  LayerProperties& operator=(const LayerProperties& a) = delete;
41
42
public:
43
0
  virtual ~LayerProperties() {}
44
45
  /**
46
   * Copies the current layer tree properties into
47
   * a new LayerProperties object.
48
   *
49
   * @param Layer tree to copy, or nullptr if we have no 
50
   * initial layer tree.
51
   */
52
  static UniquePtr<LayerProperties> CloneFrom(Layer* aRoot);
53
54
  /**
55
   * Clear all invalidation status from this layer tree.
56
   */
57
  static void ClearInvalidations(Layer* aRoot);
58
59
  /**
60
   * Compares a set of existing layer tree properties to the current layer
61
   * tree and generates the changed rectangle.
62
   *
63
   * @param aRoot Root layer of the layer tree to compare against.
64
   * @param aOutRegion Outparam that will contain the painted area changed by the layer tree changes.
65
   * @param aCallback If specified, callback to call when ContainerLayers
66
   * are invalidated.
67
   * @return True on success, false if a calculation overflowed and the entire
68
   *         layer tree area should be considered invalidated.
69
   */
70
  virtual bool ComputeDifferences(Layer* aRoot,
71
                                  nsIntRegion& aOutRegion,
72
                                  NotifySubDocInvalidationFunc aCallback) = 0;
73
74
  virtual void MoveBy(const gfx::IntPoint& aOffset) = 0;
75
};
76
77
} // namespace layers
78
} // namespace mozilla
79
80
#endif /* GFX_LAYER_TREE_INVALIDATON_H */