Dont pass `px_width` to m4, add some commented path cap tracking

incremental_update_paths
Tyler Goodlet 2022-05-17 19:14:49 -04:00
parent df1c89e811
commit 81be0b4bd0
1 changed files with 13 additions and 16 deletions

View File

@ -86,7 +86,7 @@ class FastAppendCurve(pg.GraphicsObject):
self.xData = None self.xData = None
self._vr: Optional[tuple] = None self._vr: Optional[tuple] = None
self._avr: Optional[tuple] = None self._avr: Optional[tuple] = None
self._br = None self._last_cap: int = 0
self._name = name self._name = name
self.path: Optional[QtGui.QPainterPath] = None self.path: Optional[QtGui.QPainterPath] = None
@ -238,8 +238,8 @@ class FastAppendCurve(pg.GraphicsObject):
# should_redraw = False # should_redraw = False
# by default we only pull data up to the last (current) index # by default we only pull data up to the last (current) index
x_out_full = x_out = x[:slice_to_head] x_out = x[:slice_to_head]
y_out_full = y_out = y[:slice_to_head] y_out = y[:slice_to_head]
# if a view range is passed, plan to draw the # if a view range is passed, plan to draw the
# source ouput that's "in view" of the chart. # source ouput that's "in view" of the chart.
@ -319,8 +319,7 @@ class FastAppendCurve(pg.GraphicsObject):
# check for downsampling conditions # check for downsampling conditions
if ( if (
# std m4 downsample conditions # std m4 downsample conditions
px_width abs(uppx_diff) >= 1
and abs(uppx_diff) >= 1
): ):
log.info( log.info(
f'{self._name} sampler change: {self._last_uppx} -> {uppx}' f'{self._name} sampler change: {self._last_uppx} -> {uppx}'
@ -366,12 +365,11 @@ class FastAppendCurve(pg.GraphicsObject):
self._in_ds = False self._in_ds = False
elif should_ds and uppx and px_width > 1: elif should_ds and uppx > 1:
x_out, y_out = xy_downsample( x_out, y_out = xy_downsample(
x_out, x_out,
y_out, y_out,
px_width,
uppx, uppx,
) )
profiler(f'FULL PATH downsample redraw={should_ds}') profiler(f'FULL PATH downsample redraw={should_ds}')
@ -438,7 +436,6 @@ class FastAppendCurve(pg.GraphicsObject):
# new_x, new_y = xy_downsample( # new_x, new_y = xy_downsample(
# new_x, # new_x,
# new_y, # new_y,
# px_width,
# uppx, # uppx,
# ) # )
# profiler(f'fast path downsample redraw={should_ds}') # profiler(f'fast path downsample redraw={should_ds}')
@ -489,9 +486,9 @@ class FastAppendCurve(pg.GraphicsObject):
# self.disable_cache() # self.disable_cache()
# flip_cache = True # flip_cache = True
if draw_last: # if draw_last:
self.draw_last(x, y) # self.draw_last(x, y)
profiler('draw last segment') # profiler('draw last segment')
# if flip_cache: # if flip_cache:
# # # XXX: seems to be needed to avoid artifacts (see above). # # # XXX: seems to be needed to avoid artifacts (see above).
@ -544,10 +541,6 @@ class FastAppendCurve(pg.GraphicsObject):
def getData(self): def getData(self):
return self.xData, self.yData return self.xData, self.yData
# TODO: drop the above after ``Cursor`` re-work
def get_arrays(self) -> tuple[np.ndarray, np.ndarray]:
return self._x, self._y
def clear(self): def clear(self):
''' '''
Clear internal graphics making object ready for full re-draw. Clear internal graphics making object ready for full re-draw.
@ -653,7 +646,6 @@ class FastAppendCurve(pg.GraphicsObject):
# hb_size, # hb_size,
QSizeF(w, h) QSizeF(w, h)
) )
self._br = br
# print(f'bounding rect: {br}') # print(f'bounding rect: {br}')
return br return br
@ -691,6 +683,11 @@ class FastAppendCurve(pg.GraphicsObject):
path = self.path path = self.path
# cap = path.capacity()
# if cap != self._last_cap:
# print(f'NEW CAPACITY: {self._last_cap} -> {cap}')
# self._last_cap = cap
if path: if path:
p.drawPath(path) p.drawPath(path)
profiler(f'.drawPath(path): {path.capacity()}') profiler(f'.drawPath(path): {path.capacity()}')