| 705 | } |
| 706 | |
| 707 | void Widget::getDrawableRegion(gfx::Region& region, DrawableRegionFlags flags) |
| 708 | { |
| 709 | Widget* window, *manager, *view; |
| 710 | |
| 711 | getRegion(region); |
| 712 | |
| 713 | // Cut the top windows areas |
| 714 | if (flags & kCutTopWindows) { |
| 715 | window = this->window(); |
| 716 | manager = (window ? window->manager(): nullptr); |
| 717 | |
| 718 | while (manager) { |
| 719 | const WidgetsList& windows_list = manager->children(); |
| 720 | WidgetsList::const_reverse_iterator it = |
| 721 | std::find(windows_list.rbegin(), windows_list.rend(), window); |
| 722 | |
| 723 | if (!windows_list.empty() && |
| 724 | window != windows_list.front() && |
| 725 | it != windows_list.rend()) { |
| 726 | // Subtract the rectangles |
| 727 | for (++it; it != windows_list.rend(); ++it) { |
| 728 | if (!(*it)->isVisible()) |
| 729 | continue; |
| 730 | |
| 731 | Region reg1; |
| 732 | (*it)->getRegion(reg1); |
| 733 | region.createSubtraction(region, reg1); |
| 734 | } |
| 735 | } |
| 736 | |
| 737 | window = manager->window(); |
| 738 | manager = (window ? window->manager(): nullptr); |
| 739 | } |
| 740 | } |
| 741 | |
| 742 | // Clip the areas where are children |
| 743 | if (!(flags & kUseChildArea) && !children().empty()) { |
| 744 | Region reg1; |
| 745 | Region reg2(childrenBounds()); |
| 746 | |
| 747 | for (auto child : children()) { |
| 748 | if (child->isVisible()) { |
| 749 | Region reg3; |
| 750 | child->getRegion(reg3); |
| 751 | |
| 752 | if (child->hasFlags(DECORATIVE)) { |
| 753 | reg1 = bounds(); |
| 754 | reg1.createIntersection(reg1, reg3); |
| 755 | } |
| 756 | else { |
| 757 | reg1.createIntersection(reg2, reg3); |
| 758 | } |
| 759 | region.createSubtraction(region, reg1); |
| 760 | } |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | // Intersect with the parent area |
no test coverage detected