Skip to content

Commit 5a7b2a2

Browse files
committed
framebufferio: Don't call swapbuffers unnecessarily
1 parent ffc488e commit 5a7b2a2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

shared-module/framebufferio/FramebufferDisplay.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,14 @@ STATIC void _refresh_display(framebufferio_framebufferdisplay_obj_t* self) {
219219
displayio_display_core_start_refresh(&self->core);
220220
self->framebuffer_protocol->get_bufinfo(self->framebuffer, &self->bufinfo);
221221
const displayio_area_t* current_area = _get_refresh_areas(self);
222-
while (current_area != NULL) {
223-
_refresh_area(self, current_area);
224-
current_area = current_area->next;
222+
if (current_area) {
223+
while (current_area != NULL) {
224+
_refresh_area(self, current_area);
225+
current_area = current_area->next;
226+
}
227+
self->framebuffer_protocol->swapbuffers(self->framebuffer);
225228
}
226229
displayio_display_core_finish_refresh(&self->core);
227-
self->framebuffer_protocol->swapbuffers(self->framebuffer);
228230
}
229231

230232
void common_hal_framebufferio_framebufferdisplay_set_rotation(framebufferio_framebufferdisplay_obj_t* self, int rotation){

0 commit comments

Comments
 (0)