| OLD | NEW |
| (Empty) | |
| 1 # `Source/platform/graphics/compositing` |
| 2 |
| 3 This directory contains the implementation of the "Blink compositing algorithm". |
| 4 |
| 5 This code is owned by the [paint team][paint-team-site]. |
| 6 [paint-team-site]: https://www.chromium.org/developers/paint-team |
| 7 |
| 8 This document explains the SPv2 world as it develops, not the SPv1 world it |
| 9 replaces. |
| 10 |
| 11 ## Blink compositing algorithm |
| 12 |
| 13 Design document: goo.gl/6xP8Oe |
| 14 |
| 15 Inputs: `PaintArtifact` |
| 16 Outputs: List of `cc::Layer` objects and `cc::PropertyTree`'s. |
| 17 |
| 18 The algorithm walks through the list of `PaintChunks` in the `PaintArtifact`, |
| 19 allocating new `c::Layers` if the `PaintChunk` cannot merge into an existing |
| 20 `cc::Layer`. The reasons why it would not be able to do so are: |
| 21 |
| 22 1. The `PaintChunk` requires a foreign layer (see below) |
| 23 |
| 24 2. The `PaintChunk` cannot merge with any existing layer, due incompatible |
| 25 direct compositing reasons on its `PropertyTreeState`. |
| 26 |
| 27 3. The `PaintChunk` overlaps with an earlier `cc::Layer` that it can't merge wit
h |
| 28 due to reason 2, and there is no later-drawn `cc::Layer` for which reasons 1 and |
| 29 2 do not apply. |
| 30 |
| 31 In the worst case, this algorithm has an O(n^2) running time, where n is the |
| 32 number of `PaintChunks`. |
| 33 |
| 34 All property tree nodes referred to by any `PaintChunk` are currently copied |
| 35 into their equivalent `cc::PropertyTree` node, regardless of whether they are |
| 36 required by the above. |
| 37 |
| 38 ### Flattening property tree nodes |
| 39 |
| 40 When `PaintChunks` can merge into an existing `cc::Layer`, they may have |
| 41 different `PropertyTreeState`s than the `PropertyTreeState` of the `cc::Layer`. |
| 42 If so, we need to *flatten* down the nodes that are different between the |
| 43 `PropertyTreeState` of the `PaintChunk` and the `cc::Layer`. This is done |
| 44 by iterating over the "innermostNode" of the `PropertyTreeState`, finding |
| 45 the sequence of transform, clip and effect nodes that need to be flattened, |
| 46 and turning them into a sequence of paired display items representing the |
| 47 transforms, clips and effects. The algorithm for this is spelled out in |
| 48 the designdoc at http://goo.gl/6xP8Oe. |
| 49 |
| 50 ### Foreign layers |
| 51 |
| 52 Some `PaintChunk` content requires a foreign layer, meaning a layer that is |
| 53 managed outside of the scope of this code. Examples are composited video, a |
| 54 and 2D/3D (WebGL) canvas. |
| 55 |
| 56 ### Raster invalidations |
| 57 |
| 58 Any raster invalidates on a `PaintChunk` are also mapped to the space of the |
| 59 backing `cc::Layer`. |
| OLD | NEW |