15 const std::vector<int64_t>& composition_order,
16 const std::unordered_map<int64_t, std::unique_ptr<EmbedderViewSlice>>&
18 const std::unordered_map<int64_t, DlRect>& view_rects,
19 const std::unordered_set<int64_t>& views_with_underlay_preserved) {
20 std::unordered_map<int64_t, DlRect> overlay_layers;
22 auto current_frame_view_count = composition_order.size();
28 for (
size_t i = 0;
i < current_frame_view_count;
i++) {
29 int64_t
view_id = composition_order[
i];
31 if (slice->
canvas() ==
nullptr) {
45 for (
int j =
i; j >= 0; j--) {
46 int64_t current_view_id = composition_order[j];
47 auto maybe_rect = view_rects.find(current_view_id);
49 if (maybe_rect == view_rects.end()) {
53 const DlRect current_view_rect = maybe_rect->second;
54 const DlIRect rounded_in_platform_view_rect =
56 const DlRect rounded_out_platform_view_rect =
60 std::vector<DlIRect> intersection_rects =
74 for (
auto it = intersection_rects.begin(); it != intersection_rects.end();
79 if (!it->IntersectsWithRect(rounded_in_platform_view_rect)) {
80 it = intersection_rects.erase(it);
90 DlRect partial_joined_rect;
91 for (
const DlIRect& rect : intersection_rects) {
97 rounded_out_platform_view_rect)) {
107 full_joined_rect = full_joined_rect.
Union(partial_joined_rect);
111 if (!full_joined_rect.
IsEmpty()) {
112 overlay_layers.insert({
view_id, full_joined_rect});
117 const bool preserve_underlay =
118 views_with_underlay_preserved.find(
view_id) !=
119 views_with_underlay_preserved.end();
120 if (!preserve_underlay) {
132 return overlay_layers;
std::unordered_map< int64_t, DlRect > SliceViews(DlCanvas *background_canvas, const std::vector< int64_t > &composition_order, const std::unordered_map< int64_t, std::unique_ptr< EmbedderViewSlice > > &slices, const std::unordered_map< int64_t, DlRect > &view_rects, const std::unordered_set< int64_t > &views_with_underlay_preserved)
Compute the required overlay layers and clip the view slices according to the size and position of th...