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/. */
6 #ifndef GFX_LAYER_TREE_INVALIDATION_H
7 #define GFX_LAYER_TREE_INVALIDATION_H
9 #include "nsRegion.h" // for nsIntRegion
10 #include "mozilla/UniquePtr.h" // for UniquePtr
22 * Callback for ContainerLayer invalidations.
24 * @param aContainer ContainerLayer being invalidated.
25 * @param aRegion Invalidated region in the ContainerLayer's coordinate
28 typedef void (*NotifySubDocInvalidationFunc
)(ContainerLayer
* aLayer
,
29 const nsIntRegion
& aRegion
);
32 * A set of cached layer properties (including those of child layers),
33 * used for comparing differences in layer trees.
35 struct LayerProperties
37 virtual ~LayerProperties() {}
40 * Copies the current layer tree properties into
41 * a new LayerProperties object.
43 * @param Layer tree to copy, or nullptr if we have no
46 static UniquePtr
<LayerProperties
> CloneFrom(Layer
* aRoot
);
49 * Clear all invalidation status from this layer tree.
51 static void ClearInvalidations(Layer
* aRoot
);
54 * Compares a set of existing layer tree properties to the current layer
55 * tree and generates the changed rectangle.
57 * @param aRoot Root layer of the layer tree to compare against.
58 * @param aCallback If specified, callback to call when ContainerLayers
60 * @return Painted area changed by the layer tree changes.
62 virtual nsIntRegion
ComputeDifferences(Layer
* aRoot
,
63 NotifySubDocInvalidationFunc aCallback
,
64 bool* aGeometryChanged
= nullptr) = 0;
67 virtual void MoveBy(const nsIntPoint
& aOffset
) = 0;
71 } // namespace mozilla
73 #endif /* GFX_LAYER_TREE_INVALIDATON_H */