@@ -216,10 +216,11 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self,
216216 uint8_t row_command , uint16_t set_current_column_command , uint16_t set_current_row_command ,
217217 bool data_as_commands , bool always_toggle_chip_select ,
218218 displayio_area_t * area , bool SH1107_addressing ) {
219- uint16_t x1 = area -> x1 ;
220- uint16_t x2 = area -> x2 ;
221- uint16_t y1 = area -> y1 ;
222- uint16_t y2 = area -> y2 ;
219+ uint16_t x1 = area -> x1 + self -> colstart ;
220+ uint16_t x2 = area -> x2 + self -> colstart ;
221+ uint16_t y1 = area -> y1 + self -> rowstart ;
222+ uint16_t y2 = area -> y2 + self -> rowstart ;
223+
223224 // Collapse down the dimension where multiple pixels are in a byte.
224225 if (self -> colorspace .depth < 8 ) {
225226 uint8_t pixels_per_byte = 8 / self -> colorspace .depth ;
@@ -232,6 +233,9 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self,
232233 }
233234 }
234235
236+ x2 -= 1 ;
237+ y2 -= 1 ;
238+
235239 display_chip_select_behavior_t chip_select = CHIP_SELECT_UNTOUCHED ;
236240 if (always_toggle_chip_select || data_as_commands ) {
237241 chip_select = CHIP_SELECT_TOGGLE_EVERY_BYTE ;
@@ -249,12 +253,11 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self,
249253 } else {
250254 data_type = DISPLAY_COMMAND ;
251255 }
256+
252257 if (self -> ram_width < 0x100 ) {
253- data [data_length ++ ] = x1 + self -> colstart ;
254- data [data_length ++ ] = x2 - 1 + self -> colstart ;
258+ data [data_length ++ ] = x1 ;
259+ data [data_length ++ ] = x2 ;
255260 } else {
256- x1 += self -> colstart ;
257- x2 += self -> colstart - 1 ;
258261 data [data_length ++ ] = x1 >> 8 ;
259262 data [data_length ++ ] = x1 & 0xff ;
260263 data [data_length ++ ] = x2 >> 8 ;
@@ -289,12 +292,11 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self,
289292 self -> send (self -> bus , DISPLAY_COMMAND , CHIP_SELECT_UNTOUCHED , data , 1 );
290293 data_length = 0 ;
291294 }
295+
292296 if (self -> ram_height < 0x100 ) {
293- data [data_length ++ ] = y1 + self -> rowstart ;
294- data [data_length ++ ] = y2 - 1 + self -> rowstart ;
297+ data [data_length ++ ] = y1 ;
298+ data [data_length ++ ] = y2 ;
295299 } else {
296- y1 += self -> rowstart ;
297- y2 += self -> rowstart - 1 ;
298300 data [data_length ++ ] = y1 >> 8 ;
299301 data [data_length ++ ] = y1 & 0xff ;
300302 data [data_length ++ ] = y2 >> 8 ;
0 commit comments