From e541c9ba1e03096af305d8436cde473105d8e772 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Fri, 13 Aug 2021 18:53:58 +0800 Subject: [PATCH] hoist duplicate code --- pyqtgraph/functions.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pyqtgraph/functions.py b/pyqtgraph/functions.py index 36d85531..92ad3250 100644 --- a/pyqtgraph/functions.py +++ b/pyqtgraph/functions.py @@ -1903,15 +1903,15 @@ def _arrayToQPath_all(x, y, finiteCheck): numchunks = (n + chunksize - 1) // chunksize minchunks = 3 + backfill_idx = None + if finiteCheck and not all_isfinite: + backfill_idx = _compute_backfill_indices(isfinite) + if numchunks < minchunks: # too few chunks, batching would be a pessimization poly = create_qpolygonf(n) arr = ndarray_from_qpolygonf(poly) - backfill_idx = None - if finiteCheck and not all_isfinite: - backfill_idx = _compute_backfill_indices(isfinite) - if backfill_idx is None: arr[:, 0] = x arr[:, 1] = y @@ -1925,10 +1925,6 @@ def _arrayToQPath_all(x, y, finiteCheck): path.addPolygon(poly) return path - backfill_idx = None - if finiteCheck and not all_isfinite: - backfill_idx = _compute_backfill_indices(isfinite) - # at this point, we have numchunks >= minchunks path = QtGui.QPainterPath()