@@ -156,7 +156,8 @@ STATIC const displayio_area_t* _get_refresh_areas(framebufferio_framebufferdispl
156
156
return NULL ;
157
157
}
158
158
159
- STATIC bool _refresh_area (framebufferio_framebufferdisplay_obj_t * self , const displayio_area_t * area ) {
159
+ #define MARK_ROW_DIRTY (r ) (dirty_row_bitmask[r/8] = (1 << (r & 7)))
160
+ STATIC bool _refresh_area (framebufferio_framebufferdisplay_obj_t * self , const displayio_area_t * area , uint8_t * dirty_row_bitmask ) {
160
161
uint16_t buffer_size = 128 ; // In uint32_ts
161
162
162
163
displayio_area_t clipped ;
@@ -235,6 +236,7 @@ STATIC bool _refresh_area(framebufferio_framebufferdisplay_obj_t* self, const di
235
236
236
237
for (uint16_t i = subrectangle .y1 ; i < subrectangle .y2 ; i ++ ) {
237
238
assert (dest >= buf && dest < endbuf && dest + rowsize <= endbuf );
239
+ MARK_ROW_DIRTY (i );
238
240
memcpy (dest , src , rowsize );
239
241
dest += rowstride ;
240
242
src += rowsize ;
@@ -251,12 +253,14 @@ STATIC void _refresh_display(framebufferio_framebufferdisplay_obj_t* self) {
251
253
displayio_display_core_start_refresh (& self -> core );
252
254
const displayio_area_t * current_area = _get_refresh_areas (self );
253
255
if (current_area ) {
256
+ uint8_t dirty_row_bitmask [(self -> core .height + 7 ) / 8 ];
257
+ memset (dirty_row_bitmask , 0 , sizeof (dirty_row_bitmask ));
254
258
self -> framebuffer_protocol -> get_bufinfo (self -> framebuffer , & self -> bufinfo );
255
259
while (current_area != NULL ) {
256
- _refresh_area (self , current_area );
260
+ _refresh_area (self , current_area , dirty_row_bitmask );
257
261
current_area = current_area -> next ;
258
262
}
259
- self -> framebuffer_protocol -> swapbuffers (self -> framebuffer );
263
+ self -> framebuffer_protocol -> swapbuffers (self -> framebuffer , dirty_row_bitmask );
260
264
}
261
265
displayio_display_core_finish_refresh (& self -> core );
262
266
}
0 commit comments