Clean a buncha cruft from render mod

pre_viz_calls
Tyler Goodlet 2023-01-05 18:04:40 -05:00
parent ed914328da
commit c8209dc565
1 changed files with 10 additions and 24 deletions

View File

@ -24,7 +24,6 @@ for fast incremental update.
''' '''
from __future__ import annotations from __future__ import annotations
from typing import ( from typing import (
Optional,
TYPE_CHECKING, TYPE_CHECKING,
) )
@ -61,17 +60,6 @@ class Renderer(msgspec.Struct):
path: QPainterPath | None = None path: QPainterPath | None = None
fast_path: QPainterPath | None = None fast_path: QPainterPath | None = None
# XXX: just ideas..
# called on the final data (transform) output to convert
# to "graphical data form" a format that can be passed to
# the ``.draw()`` implementation.
# graphics_t: Optional[Callable[ShmArray, np.ndarray]] = None
# graphics_t_shm: Optional[ShmArray] = None
# path graphics update implementation methods
# prepend_fn: Optional[Callable[QPainterPath, QPainterPath]] = None
# append_fn: Optional[Callable[QPainterPath, QPainterPath]] = None
# downsampling state # downsampling state
_last_uppx: float = 0 _last_uppx: float = 0
_in_ds: bool = False _in_ds: bool = False
@ -218,7 +206,7 @@ class Renderer(msgspec.Struct):
): ):
# print(f"{self.viz.name} -> REDRAWING BRUH") # print(f"{self.viz.name} -> REDRAWING BRUH")
if new_sample_rate and showing_src_data: if new_sample_rate and showing_src_data:
log.info(f'DEDOWN -> {array_key}') log.info(f'DE-downsampling -> {array_key}')
self._in_ds = False self._in_ds = False
elif should_ds and uppx > 1: elif should_ds and uppx > 1:
@ -269,10 +257,7 @@ class Renderer(msgspec.Struct):
append_length > 0 append_length > 0
and do_append and do_append
): ):
print(f'{array_key} append len: {append_length}') profiler(f'sliced append path {append_length}')
# new_x = x_1d[-append_length - 2:] # slice_to_head]
# new_y = y_1d[-append_length - 2:] # slice_to_head]
profiler('sliced append path')
# ( # (
# x_1d, # x_1d,
# y_1d, # y_1d,
@ -300,22 +285,23 @@ class Renderer(msgspec.Struct):
profiler('generated append qpath') profiler('generated append qpath')
if use_fpath: if use_fpath:
# print(f'{self.viz.name}: FAST PATH')
# an attempt at trying to make append-updates faster.. # an attempt at trying to make append-updates faster..
if fast_path is None: if fast_path is None:
fast_path = append_path fast_path = append_path
# fast_path.reserve(int(6e3)) # fast_path.reserve(int(6e3))
else: else:
# print(
# f'{self.viz.name}: FAST PATH\n'
# f"append_path br: {append_path.boundingRect()}\n"
# f"path size: {size}\n"
# f"append_path len: {append_path.length()}\n"
# f"fast_path len: {fast_path.length()}\n"
# )
fast_path.connectPath(append_path) fast_path.connectPath(append_path)
size = fast_path.capacity() size = fast_path.capacity()
profiler(f'connected fast path w size: {size}') profiler(f'connected fast path w size: {size}')
print(
f"append_path br: {append_path.boundingRect()}\n"
f"path size: {size}\n"
f"append_path len: {append_path.length()}\n"
f"fast_path len: {fast_path.length()}\n"
)
# graphics.path.moveTo(new_x[0], new_y[0]) # graphics.path.moveTo(new_x[0], new_y[0])
# path.connectPath(append_path) # path.connectPath(append_path)