@@ -216,10 +216,11 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self,
216
216
uint8_t row_command , uint16_t set_current_column_command , uint16_t set_current_row_command ,
217
217
bool data_as_commands , bool always_toggle_chip_select ,
218
218
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
+
223
224
// Collapse down the dimension where multiple pixels are in a byte.
224
225
if (self -> colorspace .depth < 8 ) {
225
226
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,
232
233
}
233
234
}
234
235
236
+ x2 -= 1 ;
237
+ y2 -= 1 ;
238
+
235
239
display_chip_select_behavior_t chip_select = CHIP_SELECT_UNTOUCHED ;
236
240
if (always_toggle_chip_select || data_as_commands ) {
237
241
chip_select = CHIP_SELECT_TOGGLE_EVERY_BYTE ;
@@ -249,12 +253,11 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self,
249
253
} else {
250
254
data_type = DISPLAY_COMMAND ;
251
255
}
256
+
252
257
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 ;
255
260
} else {
256
- x1 += self -> colstart ;
257
- x2 += self -> colstart - 1 ;
258
261
data [data_length ++ ] = x1 >> 8 ;
259
262
data [data_length ++ ] = x1 & 0xff ;
260
263
data [data_length ++ ] = x2 >> 8 ;
@@ -289,12 +292,11 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self,
289
292
self -> send (self -> bus , DISPLAY_COMMAND , CHIP_SELECT_UNTOUCHED , data , 1 );
290
293
data_length = 0 ;
291
294
}
295
+
292
296
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 ;
295
299
} else {
296
- y1 += self -> rowstart ;
297
- y2 += self -> rowstart - 1 ;
298
300
data [data_length ++ ] = y1 >> 8 ;
299
301
data [data_length ++ ] = y1 & 0xff ;
300
302
data [data_length ++ ] = y2 >> 8 ;
0 commit comments