-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Description
Looking at the code for refresh in viewport, it seems it will call self._device.display even when there's nothing to do:
luma.core/luma/core/virtual.py
Lines 113 to 127 in 6b69584
| def refresh(self): | |
| should_wait = False | |
| for hotspot, xy in self._hotspots: | |
| if hotspot.should_redraw() and self.is_overlapping_viewport(hotspot, xy): | |
| pool.add_task(hotspot.paste_into, self._backing_image, xy) | |
| should_wait = True | |
| if should_wait: | |
| pool.wait_completion() | |
| im = self._backing_image.crop(box=self._crop_box()) | |
| if self._dither: | |
| im = im.convert(self._device.mode) | |
| self._device.display(im) |
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels