aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-05-26 10:27:12 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-06-02 18:13:51 +0000
commitc2314d689e9e36dc4e104051e2c2b15d0e71d99b (patch)
tree65e7c582d1dd1ca1e7b4bda7523df206eed45f53
parentgrid: disable reflow timing by default (diff)
grid: reflow: avoid unnecessary if-statements before chunking a row
-rw-r--r--grid.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/grid.c b/grid.c
index 32107145..6d8f93c3 100644
--- a/grid.c
+++ b/grid.c
@@ -533,16 +533,21 @@ grid_resize_and_reflow(
xassert(col_count >= 0 && col_count <= old_cols);
- struct coord *tp = (*next_tp)->row == old_row_idx ? *next_tp : NULL;
- struct row_uri_range *range =
- old_row->extra != NULL && tll_length(old_row->extra->uri_ranges) > 0
- ? &tll_front(old_row->extra->uri_ranges)
- : NULL;
-
- if (tp != NULL)
+ /* Do we have a (at least one) tracking point on this row */
+ struct coord *tp;
+ if ((*next_tp)->row == old_row_idx) {
+ tp = *next_tp;
col_count = max(col_count, tp->col + 1);
- if (range != NULL)
+ } else
+ tp = NULL;
+
+ /* Does this row have any URIs? */
+ struct row_uri_range *range;
+ if (old_row->extra != NULL && tll_length(old_row->extra->uri_ranges) > 0) {
+ range = &tll_front(old_row->extra->uri_ranges);
col_count = max(col_count, range->end + 1);
+ } else
+ range = NULL;
for (int start = 0, left = col_count; left > 0;) {
int end;