MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / getDrawableRegion

Method getDrawableRegion

src/ui/widget.cpp:707–800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

705}
706
707void 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

Callers 6

flushMethod · 0.80
showMethod · 0.80
hideMethod · 0.80
flushRedrawMethod · 0.80
paintMethod · 0.80
onSetViewScrollMethod · 0.80

Calls 15

windowMethod · 0.95
parentMethod · 0.95
managerMethod · 0.80
rbeginMethod · 0.80
rendMethod · 0.80
getRegionMethod · 0.80
childrenBoundsMethod · 0.80
viewportBoundsMethod · 0.80
RegionClass · 0.70
emptyMethod · 0.45
frontMethod · 0.45
isVisibleMethod · 0.45

Tested by

no test coverage detected