14
14
#include "shared-bindings/vectorio/Rectangle.h"
15
15
16
16
// Lifecycle actions.
17
- // #define VECTORIO_SHAPE_DEBUG(...) (void)0
18
- #define VECTORIO_SHAPE_DEBUG (...) mp_printf(&mp_plat_print, __VA_ARGS__)
17
+ #define VECTORIO_SHAPE_DEBUG (...) (void)0
18
+ // #define VECTORIO_SHAPE_DEBUG(...) mp_printf(&mp_plat_print, __VA_ARGS__)
19
19
20
20
21
21
// Used in both logging and ifdefs, for extra variables
22
22
// #define VECTORIO_PERF(...) mp_printf(&mp_plat_print, __VA_ARGS__)
23
23
24
24
25
25
// Really verbose.
26
- // #define VECTORIO_SHAPE_PIXEL_DEBUG(...) (void)0
27
- #define VECTORIO_SHAPE_PIXEL_DEBUG (...) mp_printf(&mp_plat_print, __VA_ARGS__)
26
+ #define VECTORIO_SHAPE_PIXEL_DEBUG (...) (void)0
27
+ // #define VECTORIO_SHAPE_PIXEL_DEBUG(...) mp_printf(&mp_plat_print, __VA_ARGS__)
28
28
29
29
#define U32_TO_BINARY_FMT "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c"
30
30
#define U32_TO_BINARY (u32 ) \
@@ -244,15 +244,8 @@ bool vectorio_vector_shape_fill_area(vectorio_vector_shape_t *self, const _displ
244
244
displayio_input_pixel_t input_pixel ;
245
245
displayio_output_pixel_t output_pixel ;
246
246
247
- uint16_t width_px_indices ;
248
- uint16_t height_px_indices ;
249
- if (self -> absolute_transform -> transpose_xy ) {
250
- width_px_indices = displayio_area_height (& self -> current_area ) - 1 ;
251
- height_px_indices = displayio_area_width (& self -> current_area ) - 1 ;
252
- } else {
253
- width_px_indices = displayio_area_width (& self -> current_area ) - 1 ;
254
- height_px_indices = displayio_area_height (& self -> current_area ) - 1 ;
255
- }
247
+ displayio_area_t shape_area ;
248
+ self -> ishape .get_area (self -> ishape .shape , & shape_area );
256
249
257
250
uint16_t mask_start_px = line_dirty_offset_px ;
258
251
for (input_pixel .y = overlap .y1 ; input_pixel .y < overlap .y2 ; ++ input_pixel .y ) {
@@ -275,22 +268,24 @@ bool vectorio_vector_shape_fill_area(vectorio_vector_shape_t *self, const _displ
275
268
if (self -> absolute_transform -> transpose_xy ) {
276
269
pixel_to_get_x = input_pixel .y - self -> absolute_transform -> y - self -> absolute_transform -> dy * self -> x ;
277
270
pixel_to_get_y = input_pixel .x - self -> absolute_transform -> x - self -> absolute_transform -> dx * self -> y ;
271
+ VECTORIO_SHAPE_PIXEL_DEBUG (" a(%3d, %3d)" , pixel_to_get_x , pixel_to_get_y );
278
272
279
273
if (self -> absolute_transform -> mirror_x ) {
280
- pixel_to_get_y = height_px_indices - pixel_to_get_y ;
274
+ pixel_to_get_y = shape_area . y2 - 1 - ( pixel_to_get_y - shape_area . y1 ) ;
281
275
}
282
276
if (self -> absolute_transform -> mirror_y ) {
283
- pixel_to_get_x = width_px_indices - pixel_to_get_x ;
277
+ pixel_to_get_x = shape_area . x2 - 1 - ( pixel_to_get_x - shape_area . x1 ) ;
284
278
}
285
279
} else {
286
280
pixel_to_get_x = input_pixel .x - self -> absolute_transform -> x - self -> absolute_transform -> dx * self -> x ;
287
281
pixel_to_get_y = input_pixel .y - self -> absolute_transform -> y - self -> absolute_transform -> dy * self -> y ;
282
+ VECTORIO_SHAPE_PIXEL_DEBUG (" a(%3d, %3d)" , pixel_to_get_x , pixel_to_get_y );
288
283
289
284
if (self -> absolute_transform -> mirror_x ) {
290
- pixel_to_get_x = width_px_indices - pixel_to_get_x ;
285
+ pixel_to_get_x = shape_area . x2 - 1 - ( pixel_to_get_x - shape_area . x1 ) ;
291
286
}
292
287
if (self -> absolute_transform -> mirror_y ) {
293
- pixel_to_get_y = height_px_indices - pixel_to_get_y ;
288
+ pixel_to_get_y = shape_area . y2 - 1 - ( pixel_to_get_y - shape_area . y1 ) ;
294
289
}
295
290
}
296
291
0 commit comments