| 1 | // SPDX-License-Identifier: MPL-2.0 |
| 2 | // Copyright (c) Yuxuan Shui <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include <picom/types.h> |
| 7 | |
| 8 | typedef struct pixman_region32 region_t; |
| 9 | struct layout; |
| 10 | struct layout_manager; |
| 11 | struct backend_mask; |
| 12 | /// Remove unnecessary parts of the render commands. |
| 13 | /// |
| 14 | /// After this call, the commands' regions of operations no longer point to their `mask` |
| 15 | /// fields. they point to `culled_mask` instead. The values of their `mask` fields are |
| 16 | /// retained, so later the commands can be "un-culled". |
| 17 | /// |
| 18 | /// @param culled_mask use to stored the culled masks, must be have space to store at |
| 19 | /// least `layout->number_of_commands` elements. They MUST be |
| 20 | /// initialized before calling this function. These masks MUST NOT be |
| 21 | /// freed until you call `commands_uncull`. |
| 22 | void commands_cull_with_damage(struct layout *layout, const region_t *damage, |
| 23 | ivec2 blur_size, region_t *culled_mask); |
| 24 | |
| 25 | /// Un-do the effect of `commands_cull_with_damage` |
| 26 | void commands_uncull(struct layout *layout); |
| 27 | |
| 28 | /// Calculate damage of the screen for the last `buffer_age` layouts. Assuming the |
| 29 | /// current, yet to be rendered frame is numbered frame 0, the previous frame is numbered |
| 30 | /// frame -1, and so on. This function returns the region of the screen that will be |
| 31 | /// different between frame `-buffer_age` and frame 0. The region is in screen |
| 32 | /// coordinates. `buffer_age` is at least 1, and must be less than the `max_buffer_age` |
| 33 | /// passed to the `layout_manager_new` that was used to create `lm`. |
| 34 | /// |
| 35 | /// The layouts you want to calculate damage for must already have commands built for |
| 36 | /// them. `blur_size` is the size of the background blur, and is assumed to not change |
| 37 | /// over time. |
| 38 | /// |
| 39 | /// Note `layout_manager_damage` cannot take desktop background change into |
| 40 | /// account. |
| 41 | void layout_manager_damage(struct layout_manager *lm, unsigned buffer_age, |
| 42 | ivec2 blur_size, region_t *damage); |