diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-12 14:52:04 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-12 14:52:04 +0300 |
commit | 12262e7642489f1764018ef23b4913c203ddd9ab (patch) | |
tree | 36ccebcc5e566ad18d4ad67cbddd781a47ce432c | |
parent | 33620846cca5678fbd662ea1a48fad302727dae7 (diff) |
Widget: More accurate draw count
-rw-r--r-- | src/ui/widget.c | 10 |
1 files changed, 8 insertions, 2 deletions
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) { | |||
1367 | } | 1367 | } |
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | iLocalDef void incrementDrawCount_(const iWidget *d) { | ||
1371 | if (class_Widget(d) != &Class_Widget || d->bgColor >= 0 || d->frameColor >= 0) { | ||
1372 | drawCount_++; | ||
1373 | } | ||
1374 | } | ||
1375 | |||
1370 | void drawChildren_Widget(const iWidget *d) { | 1376 | void drawChildren_Widget(const iWidget *d) { |
1371 | if (!isDrawn_Widget_(d)) { | 1377 | if (!isDrawn_Widget_(d)) { |
1372 | return; | 1378 | return; |
@@ -1374,7 +1380,7 @@ void drawChildren_Widget(const iWidget *d) { | |||
1374 | iConstForEach(ObjectList, i, d->children) { | 1380 | iConstForEach(ObjectList, i, d->children) { |
1375 | const iWidget *child = constAs_Widget(i.object); | 1381 | const iWidget *child = constAs_Widget(i.object); |
1376 | if (~child->flags & keepOnTop_WidgetFlag && isDrawn_Widget_(child)) { | 1382 | if (~child->flags & keepOnTop_WidgetFlag && isDrawn_Widget_(child)) { |
1377 | drawCount_++; | 1383 | incrementDrawCount_(child); |
1378 | class_Widget(child)->draw(child); | 1384 | class_Widget(child)->draw(child); |
1379 | } | 1385 | } |
1380 | } | 1386 | } |
@@ -1387,7 +1393,7 @@ void drawRoot_Widget(const iWidget *d) { | |||
1387 | init_PtrArray(&pvs); | 1393 | init_PtrArray(&pvs); |
1388 | findPotentiallyVisible_Widget_(d, &pvs); | 1394 | findPotentiallyVisible_Widget_(d, &pvs); |
1389 | iReverseConstForEach(PtrArray, i, &pvs) { | 1395 | iReverseConstForEach(PtrArray, i, &pvs) { |
1390 | drawCount_++; | 1396 | incrementDrawCount_(i.ptr); |
1391 | class_Widget(i.ptr)->draw(i.ptr); | 1397 | class_Widget(i.ptr)->draw(i.ptr); |
1392 | } | 1398 | } |
1393 | deinit_PtrArray(&pvs); | 1399 | deinit_PtrArray(&pvs); |