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