Always use coord cache, add naive view range diffing logic
parent
dc4a0a6fd2
commit
d3251a2922
|
@ -183,7 +183,7 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
# interactions slower (such as zooming) and if so maybe if/when
|
# interactions slower (such as zooming) and if so maybe if/when
|
||||||
# we implement a "history" mode for the view we disable this in
|
# we implement a "history" mode for the view we disable this in
|
||||||
# that mode?
|
# that mode?
|
||||||
if step_mode:
|
# if step_mode:
|
||||||
# don't enable caching by default for the case where the
|
# don't enable caching by default for the case where the
|
||||||
# only thing drawn is the "last" line segment which can
|
# only thing drawn is the "last" line segment which can
|
||||||
# have a weird artifact where it won't be fully drawn to its
|
# have a weird artifact where it won't be fully drawn to its
|
||||||
|
@ -192,7 +192,7 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
QGraphicsItem.DeviceCoordinateCache
|
QGraphicsItem.DeviceCoordinateCache
|
||||||
)
|
)
|
||||||
|
|
||||||
self.update()
|
# self.update()
|
||||||
|
|
||||||
# TODO: probably stick this in a new parent
|
# TODO: probably stick this in a new parent
|
||||||
# type which will contain our own version of
|
# type which will contain our own version of
|
||||||
|
@ -313,7 +313,7 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
uppx_diff = (uppx - self._last_uppx)
|
uppx_diff = (uppx - self._last_uppx)
|
||||||
|
|
||||||
new_sample_rate = False
|
new_sample_rate = False
|
||||||
should_ds = False
|
should_ds = self._in_ds
|
||||||
showing_src_data = self._in_ds
|
showing_src_data = self._in_ds
|
||||||
should_redraw = False
|
should_redraw = False
|
||||||
|
|
||||||
|
@ -330,11 +330,27 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
x_out, y_out = x_iv[:-1], y_iv[:-1]
|
x_out, y_out = x_iv[:-1], y_iv[:-1]
|
||||||
profiler(f'view range slice {view_range}')
|
profiler(f'view range slice {view_range}')
|
||||||
|
|
||||||
|
ivl, ivr = view_range
|
||||||
|
|
||||||
|
probably_zoom_change = False
|
||||||
|
last_vr = self._vr
|
||||||
|
if last_vr:
|
||||||
|
livl, livr = last_vr
|
||||||
if (
|
if (
|
||||||
view_range != self._vr
|
ivl < livl
|
||||||
and append_length > 1
|
or (ivr - livr) > 2
|
||||||
|
):
|
||||||
|
probably_zoom_change = True
|
||||||
|
|
||||||
|
if (
|
||||||
|
view_range != last_vr
|
||||||
|
and (
|
||||||
|
append_length > 1
|
||||||
|
or probably_zoom_change
|
||||||
|
)
|
||||||
):
|
):
|
||||||
should_redraw = True
|
should_redraw = True
|
||||||
|
# print("REDRAWING BRUH")
|
||||||
|
|
||||||
self._vr = view_range
|
self._vr = view_range
|
||||||
|
|
||||||
|
@ -371,6 +387,7 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
self._last_uppx = uppx
|
self._last_uppx = uppx
|
||||||
new_sample_rate = True
|
new_sample_rate = True
|
||||||
showing_src_data = False
|
showing_src_data = False
|
||||||
|
should_redraw = True
|
||||||
should_ds = True
|
should_ds = True
|
||||||
|
|
||||||
elif (
|
elif (
|
||||||
|
@ -504,13 +521,14 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
f'diffed array input, append_length={append_length}'
|
f'diffed array input, append_length={append_length}'
|
||||||
)
|
)
|
||||||
|
|
||||||
if should_ds:
|
# if should_ds:
|
||||||
new_x, new_y = self.downsample(
|
# new_x, new_y = self.downsample(
|
||||||
new_x,
|
# new_x,
|
||||||
new_y,
|
# new_y,
|
||||||
**should_ds,
|
# px_width,
|
||||||
)
|
# uppx,
|
||||||
profiler(f'fast path downsample redraw={should_ds}')
|
# )
|
||||||
|
# profiler(f'fast path downsample redraw={should_ds}')
|
||||||
|
|
||||||
append_path = pg.functions.arrayToQPath(
|
append_path = pg.functions.arrayToQPath(
|
||||||
new_x,
|
new_x,
|
||||||
|
|
Loading…
Reference in New Issue