@@ -62,10 +62,10 @@ typedef struct _mp_framebuf_p_t {
62
62
63
63
// Functions for MHLSB and MHMSB
64
64
65
- STATIC void mono_horiz_setpixel (const mp_obj_framebuf_t * fb , int x , int y , uint32_t color ) {
65
+ STATIC void mono_horiz_setpixel (const mp_obj_framebuf_t * fb , int x , int y , uint32_t col ) {
66
66
size_t index = (x + y * fb -> stride ) >> 3 ;
67
67
int offset = fb -> format == FRAMEBUF_MHMSB ? x & 0x07 : 7 - (x & 0x07 );
68
- ((uint8_t * )fb -> buf )[index ] = (((uint8_t * )fb -> buf )[index ] & ~(0x01 << offset )) | ((color != 0 ) << offset );
68
+ ((uint8_t * )fb -> buf )[index ] = (((uint8_t * )fb -> buf )[index ] & ~(0x01 << offset )) | ((col != 0 ) << offset );
69
69
}
70
70
71
71
STATIC uint32_t mono_horiz_getpixel (const mp_obj_framebuf_t * fb , int x , int y ) {
@@ -90,10 +90,10 @@ STATIC void mono_horiz_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int
90
90
91
91
// Functions for MVLSB format
92
92
93
- STATIC void mvlsb_setpixel (const mp_obj_framebuf_t * fb , int x , int y , uint32_t color ) {
93
+ STATIC void mvlsb_setpixel (const mp_obj_framebuf_t * fb , int x , int y , uint32_t col ) {
94
94
size_t index = (y >> 3 ) * fb -> stride + x ;
95
95
uint8_t offset = y & 0x07 ;
96
- ((uint8_t * )fb -> buf )[index ] = (((uint8_t * )fb -> buf )[index ] & ~(0x01 << offset )) | ((color != 0 ) << offset );
96
+ ((uint8_t * )fb -> buf )[index ] = (((uint8_t * )fb -> buf )[index ] & ~(0x01 << offset )) | ((col != 0 ) << offset );
97
97
}
98
98
99
99
STATIC uint32_t mvlsb_getpixel (const mp_obj_framebuf_t * fb , int x , int y ) {
@@ -114,19 +114,19 @@ STATIC void mvlsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, in
114
114
115
115
// Functions for RGB565 format
116
116
117
- STATIC void rgb565_setpixel (const mp_obj_framebuf_t * fb , int x , int y , uint32_t color ) {
118
- ((uint16_t * )fb -> buf )[x + y * fb -> stride ] = color ;
117
+ STATIC void rgb565_setpixel (const mp_obj_framebuf_t * fb , int x , int y , uint32_t col ) {
118
+ ((uint16_t * )fb -> buf )[x + y * fb -> stride ] = col ;
119
119
}
120
120
121
121
STATIC uint32_t rgb565_getpixel (const mp_obj_framebuf_t * fb , int x , int y ) {
122
122
return ((uint16_t * )fb -> buf )[x + y * fb -> stride ];
123
123
}
124
124
125
- STATIC void rgb565_fill_rect (const mp_obj_framebuf_t * fb , int x , int y , int w , int h , uint32_t colour ) {
125
+ STATIC void rgb565_fill_rect (const mp_obj_framebuf_t * fb , int x , int y , int w , int h , uint32_t col ) {
126
126
uint16_t * b = & ((uint16_t * )fb -> buf )[x + y * fb -> stride ];
127
127
while (h -- ) {
128
128
for (int ww = w ; ww ; -- ww ) {
129
- * b ++ = colour ;
129
+ * b ++ = col ;
130
130
}
131
131
b += fb -> stride - w ;
132
132
}
@@ -156,7 +156,7 @@ STATIC void gs4_hmsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w,
156
156
col &= 0x0f ;
157
157
uint8_t * pixel_pair = & ((uint8_t * )fb -> buf )[(x + y * fb -> stride ) >> 1 ];
158
158
uint8_t col_shifted_left = col << 4 ;
159
- uint8_t colored_pixel_pair = col_shifted_left | col ;
159
+ uint8_t col_pixel_pair = col_shifted_left | col ;
160
160
int pixel_count_till_next_line = (fb -> stride - w ) >> 1 ;
161
161
bool odd_x = (x % 2 == 1 );
162
162
@@ -169,7 +169,7 @@ STATIC void gs4_hmsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w,
169
169
ww -- ;
170
170
}
171
171
172
- memset (pixel_pair , colored_pixel_pair , ww >> 1 );
172
+ memset (pixel_pair , col_pixel_pair , ww >> 1 );
173
173
pixel_pair += ww >> 1 ;
174
174
175
175
if (ww % 2 ) {
@@ -191,8 +191,8 @@ STATIC mp_framebuf_p_t formats[] = {
191
191
[FRAMEBUF_MHMSB ] = {mono_horiz_setpixel , mono_horiz_getpixel , mono_horiz_fill_rect },
192
192
};
193
193
194
- static inline void setpixel (const mp_obj_framebuf_t * fb , int x , int y , uint32_t color ) {
195
- formats [fb -> format ].setpixel (fb , x , y , color );
194
+ static inline void setpixel (const mp_obj_framebuf_t * fb , int x , int y , uint32_t col ) {
195
+ formats [fb -> format ].setpixel (fb , x , y , col );
196
196
}
197
197
198
198
static inline uint32_t getpixel (const mp_obj_framebuf_t * fb , int x , int y ) {
@@ -277,9 +277,9 @@ STATIC mp_obj_t framebuf_fill_rect(size_t n_args, const mp_obj_t *args) {
277
277
mp_int_t y = mp_obj_get_int (args [2 ]);
278
278
mp_int_t width = mp_obj_get_int (args [3 ]);
279
279
mp_int_t height = mp_obj_get_int (args [4 ]);
280
- mp_int_t color = mp_obj_get_int (args [5 ]);
280
+ mp_int_t col = mp_obj_get_int (args [5 ]);
281
281
282
- fill_rect (self , x , y , width , height , color );
282
+ fill_rect (self , x , y , width , height , col );
283
283
284
284
return mp_const_none ;
285
285
}
@@ -444,14 +444,13 @@ STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args) {
444
444
int y1 = MAX (0 , - y );
445
445
int x0end = MIN (self -> width , x + source -> width );
446
446
int y0end = MIN (self -> height , y + source -> height );
447
- uint32_t color ;
448
447
449
448
for (; y0 < y0end ; ++ y0 ) {
450
449
int cx1 = x1 ;
451
450
for (int cx0 = x0 ; cx0 < x0end ; ++ cx0 ) {
452
- color = getpixel (source , cx1 , y1 );
453
- if (color != (uint32_t )key ) {
454
- setpixel (self , cx0 , y0 , color );
451
+ uint32_t col = getpixel (source , cx1 , y1 );
452
+ if (col != (uint32_t )key ) {
453
+ setpixel (self , cx0 , y0 , col );
455
454
}
456
455
++ cx1 ;
457
456
}
0 commit comments