1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/layers/LayerTreeInvalidation.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,72 @@ 1.4 +/*-*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef GFX_LAYER_TREE_INVALIDATION_H 1.10 +#define GFX_LAYER_TREE_INVALIDATION_H 1.11 + 1.12 +#include "nsRegion.h" // for nsIntRegion 1.13 + 1.14 +class nsPresContext; 1.15 +struct nsIntPoint; 1.16 + 1.17 +namespace mozilla { 1.18 +namespace layers { 1.19 + 1.20 +class Layer; 1.21 +class ContainerLayer; 1.22 + 1.23 +/** 1.24 + * Callback for ContainerLayer invalidations. 1.25 + * 1.26 + * @param aContainer ContainerLayer being invalidated. 1.27 + * @param aRegion Invalidated region in the ContainerLayer's coordinate 1.28 + * space. 1.29 + */ 1.30 +typedef void (*NotifySubDocInvalidationFunc)(ContainerLayer* aLayer, 1.31 + const nsIntRegion& aRegion); 1.32 + 1.33 +/** 1.34 + * A set of cached layer properties (including those of child layers), 1.35 + * used for comparing differences in layer trees. 1.36 + */ 1.37 +struct LayerProperties 1.38 +{ 1.39 + virtual ~LayerProperties() {} 1.40 + 1.41 + /** 1.42 + * Copies the current layer tree properties into 1.43 + * a new LayerProperties object. 1.44 + * 1.45 + * @param Layer tree to copy, or nullptr if we have no 1.46 + * initial layer tree. 1.47 + */ 1.48 + static LayerProperties* CloneFrom(Layer* aRoot); 1.49 + 1.50 + /** 1.51 + * Clear all invalidation status from this layer tree. 1.52 + */ 1.53 + static void ClearInvalidations(Layer* aRoot); 1.54 + 1.55 + /** 1.56 + * Compares a set of existing layer tree properties to the current layer 1.57 + * tree and generates the changed rectangle. 1.58 + * 1.59 + * @param aRoot Root layer of the layer tree to compare against. 1.60 + * @param aCallback If specified, callback to call when ContainerLayers 1.61 + * are invalidated. 1.62 + * @return Painted area changed by the layer tree changes. 1.63 + */ 1.64 + virtual nsIntRegion ComputeDifferences(Layer* aRoot, 1.65 + NotifySubDocInvalidationFunc aCallback, 1.66 + bool* aGeometryChanged = nullptr) = 0; 1.67 + 1.68 + 1.69 + virtual void MoveBy(const nsIntPoint& aOffset) = 0; 1.70 +}; 1.71 + 1.72 +} // namespace layers 1.73 +} // namespace mozilla 1.74 + 1.75 +#endif /* GFX_LAYER_TREE_INVALIDATON_H */