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

Method paint

src/ui/widget.cpp:984–1025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

982}
983
984void Widget::paint(Graphics* graphics, const gfx::Region& drawRegion)
985{
986 if (drawRegion.isEmpty())
987 return;
988
989 std::queue<Widget*> processing;
990 processing.push(this);
991
992 while (!processing.empty()) {
993 Widget* widget = processing.front();
994 processing.pop();
995
996 ASSERT_VALID_WIDGET(widget);
997
998 // If the widget is hidden
999 if (!widget->isVisible())
1000 continue;
1001
1002 for (auto child : widget->children())
1003 processing.push(child);
1004
1005 // Intersect drawRegion with widget's drawable region.
1006 Region region;
1007 widget->getDrawableRegion(region, kCutTopWindows);
1008 region.createIntersection(region, drawRegion);
1009
1010 Graphics graphics2(
1011 graphics->getInternalSurface(),
1012 widget->bounds().x,
1013 widget->bounds().y);
1014 graphics2.setFont(widget->font());
1015
1016 for (Region::const_iterator
1017 it = region.begin(),
1018 end = region.end(); it != end; ++it) {
1019 IntersectClip clip(&graphics2, Rect(*it).offset(
1020 -widget->bounds().x,
1021 -widget->bounds().y));
1022 widget->paintEvent(&graphics2);
1023 }
1024 }
1025}
1026
1027bool Widget::paintEvent(Graphics* graphics)
1028{

Callers 1

paintEventMethod · 0.45

Calls 15

popMethod · 0.80
getDrawableRegionMethod · 0.80
getInternalSurfaceMethod · 0.80
setFontMethod · 0.80
paintEventMethod · 0.80
isEmptyMethod · 0.45
pushMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45
isVisibleMethod · 0.45
createIntersectionMethod · 0.45
boundsMethod · 0.45

Tested by

no test coverage detected