Skip to content

Commit a32a318

Browse files
committed
fix vectorio rotation issue
1 parent 68cdc53 commit a32a318

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

shared-module/vectorio/VectorShape.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,12 @@ static void _get_screen_area(vectorio_vector_shape_t *self, displayio_area_t *ou
9696
x = self->absolute_transform->x + self->absolute_transform->dx * self->y;
9797
y = self->absolute_transform->y + self->absolute_transform->dy * self->x;
9898
if (self->absolute_transform->dx < 1) {
99+
x -= 1;
99100
out_area->y1 = out_area->y1 * -1 + 1;
100101
out_area->y2 = out_area->y2 * -1 + 1;
101102
}
102103
if (self->absolute_transform->dy < 1) {
104+
y -= 1;
103105
out_area->x1 = out_area->x1 * -1 + 1;
104106
out_area->x2 = out_area->x2 * -1 + 1;
105107
}
@@ -109,10 +111,12 @@ static void _get_screen_area(vectorio_vector_shape_t *self, displayio_area_t *ou
109111
y = self->absolute_transform->y + self->absolute_transform->dy * self->y;
110112

111113
if (self->absolute_transform->dx < 1) {
114+
x -= 1;
112115
out_area->x1 = out_area->x1 * -1 + 1;
113116
out_area->x2 = out_area->x2 * -1 + 1;
114117
}
115118
if (self->absolute_transform->dy < 1) {
119+
y -= 1;
116120
out_area->y1 = out_area->y1 * -1 + 1;
117121
out_area->y2 = out_area->y2 * -1 + 1;
118122
}
@@ -132,9 +136,11 @@ static void screen_to_shape_coordinates(vectorio_vector_shape_t *self, uint16_t
132136
VECTORIO_SHAPE_PIXEL_DEBUG(" a(%3d, %3d)", *out_shape_x, *out_shape_y);
133137
if (self->absolute_transform->dx < 1) {
134138
*out_shape_y *= -1;
139+
*out_shape_y -= 1;
135140
}
136141
if (self->absolute_transform->dy < 1) {
137142
*out_shape_x *= -1;
143+
*out_shape_x -= 1;
138144
}
139145
VECTORIO_SHAPE_PIXEL_DEBUG(" b(%3d, %3d)", *out_shape_x, *out_shape_y);
140146
} else {
@@ -144,9 +150,11 @@ static void screen_to_shape_coordinates(vectorio_vector_shape_t *self, uint16_t
144150
VECTORIO_SHAPE_PIXEL_DEBUG(" a(%3d, %3d)", *out_shape_x, *out_shape_y);
145151
if (self->absolute_transform->dx < 1) {
146152
*out_shape_x *= -1;
153+
*out_shape_x -= 1;
147154
}
148155
if (self->absolute_transform->dy < 1) {
149156
*out_shape_y *= -1;
157+
*out_shape_y -= 1;
150158
}
151159
VECTORIO_SHAPE_PIXEL_DEBUG(" b(%3d, %3d)", *out_shape_x, *out_shape_y);
152160

0 commit comments

Comments
 (0)