From 12262e7642489f1764018ef23b4913c203ddd9ab Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sun, 12 Sep 2021 14:52:04 +0300 Subject: Widget: More accurate draw count --- src/ui/widget.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/ui/widget.c') diff --git a/src/ui/widget.c b/src/ui/widget.c index 66cd0e7b..7665c5bc 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c @@ -1367,6 +1367,12 @@ static void findPotentiallyVisible_Widget_(const iWidget *d, iPtrArray *pvs) { } } +iLocalDef void incrementDrawCount_(const iWidget *d) { + if (class_Widget(d) != &Class_Widget || d->bgColor >= 0 || d->frameColor >= 0) { + drawCount_++; + } +} + void drawChildren_Widget(const iWidget *d) { if (!isDrawn_Widget_(d)) { return; @@ -1374,7 +1380,7 @@ void drawChildren_Widget(const iWidget *d) { iConstForEach(ObjectList, i, d->children) { const iWidget *child = constAs_Widget(i.object); if (~child->flags & keepOnTop_WidgetFlag && isDrawn_Widget_(child)) { - drawCount_++; + incrementDrawCount_(child); class_Widget(child)->draw(child); } } @@ -1387,7 +1393,7 @@ void drawRoot_Widget(const iWidget *d) { init_PtrArray(&pvs); findPotentiallyVisible_Widget_(d, &pvs); iReverseConstForEach(PtrArray, i, &pvs) { - drawCount_++; + incrementDrawCount_(i.ptr); class_Widget(i.ptr)->draw(i.ptr); } deinit_PtrArray(&pvs); -- cgit v1.2.3