luma.core
luma.core copied to clipboard
Make refresh on viewport no-op if there's nothing to do
Looking at the code for refresh
in viewport
, it seems it will call self._device.display
even when there's nothing to do:
https://github.com/rm-hull/luma.core/blob/6b69584e41a286ef09bab4a371b407120fb27f9b/luma/core/virtual.py#L113-L127
Since this function is usually called often (i.e. once per frame), would it make sense to skip this step if the image hasn't changed (i.e. should_wait == false
)? I understand refresh
is also called from display
and set_position
in which case it wouldn't be desirable to skip this step, but this could be mitigated by adding a flat to it, i.e. refresh(force = False)
and calling it as refresh(True)
from those two spots.