@@ -146,13 +146,20 @@ where
146
146
self . max_y = 0 ;
147
147
148
148
// Tell the display to update only the part that has changed
149
+ let offset_x = match self . properties . get_rotation ( ) {
150
+ DisplayRotation :: Rotate0 | DisplayRotation :: Rotate270 => DSIZE :: OFFSETX ,
151
+ DisplayRotation :: Rotate180 | DisplayRotation :: Rotate90 => {
152
+ // If segment remapping is flipped, we need to calculate
153
+ // the offset from the other edge of the display.
154
+ DSIZE :: DRIVER_COLS - DSIZE :: WIDTH - DSIZE :: OFFSETX
155
+ }
156
+ } ;
149
157
match self . properties . get_rotation ( ) {
150
158
DisplayRotation :: Rotate0 | DisplayRotation :: Rotate180 => {
151
159
self . properties . set_draw_area (
152
- ( disp_min_x + DSIZE :: OFFSETX , disp_min_y + DSIZE :: OFFSETY ) ,
153
- ( disp_max_x + DSIZE :: OFFSETX , disp_max_y + DSIZE :: OFFSETY ) ,
160
+ ( disp_min_x + offset_x , disp_min_y + DSIZE :: OFFSETY ) ,
161
+ ( disp_max_x + offset_x , disp_max_y + DSIZE :: OFFSETY ) ,
154
162
) ?;
155
-
156
163
self . properties . bounded_draw (
157
164
& self . buffer ,
158
165
width as usize ,
@@ -162,10 +169,9 @@ where
162
169
}
163
170
DisplayRotation :: Rotate90 | DisplayRotation :: Rotate270 => {
164
171
self . properties . set_draw_area (
165
- ( disp_min_y + DSIZE :: OFFSETY , disp_min_x + DSIZE :: OFFSETX ) ,
166
- ( disp_max_y + DSIZE :: OFFSETY , disp_max_x + DSIZE :: OFFSETX ) ,
172
+ ( disp_min_y + offset_x , disp_min_x + DSIZE :: OFFSETY ) ,
173
+ ( disp_max_y + offset_x , disp_max_x + DSIZE :: OFFSETY ) ,
167
174
) ?;
168
-
169
175
self . properties . bounded_draw (
170
176
& self . buffer ,
171
177
height as usize ,
0 commit comments