@@ -72,10 +72,10 @@ static int sdl_display_init(struct device *dev)
72
72
static void sdl_display_write_argb8888 (void * disp_buf ,
73
73
const struct display_buffer_descriptor * desc , const void * buf )
74
74
{
75
- __ASSERT ((4 * desc -> pitch * desc -> height ) <= desc -> buf_size ,
75
+ __ASSERT ((desc -> pitch * 4U * desc -> height ) <= desc -> buf_size ,
76
76
"Input buffer to small" );
77
77
78
- memcpy (disp_buf , buf , 4 * desc -> pitch * desc -> height );
78
+ memcpy (disp_buf , buf , desc -> pitch * 4U * desc -> height );
79
79
}
80
80
81
81
static void sdl_display_write_rgb888 (u8_t * disp_buf ,
@@ -86,13 +86,13 @@ static void sdl_display_write_rgb888(u8_t *disp_buf,
86
86
u32_t pixel ;
87
87
const u8_t * byte_ptr ;
88
88
89
- __ASSERT ((3 * desc -> pitch * desc -> height ) <= desc -> buf_size ,
89
+ __ASSERT ((desc -> pitch * 3U * desc -> height ) <= desc -> buf_size ,
90
90
"Input buffer to small" );
91
91
92
92
for (h_idx = 0U ; h_idx < desc -> height ; ++ h_idx ) {
93
93
for (w_idx = 0U ; w_idx < desc -> width ; ++ w_idx ) {
94
94
byte_ptr = (const u8_t * )buf +
95
- 3 * ((h_idx * desc -> pitch ) + w_idx );
95
+ ((h_idx * desc -> pitch ) + w_idx ) * 3U ;
96
96
pixel = * byte_ptr << 16 ;
97
97
pixel |= * (byte_ptr + 1 ) << 8 ;
98
98
pixel |= * (byte_ptr + 2 );
@@ -114,7 +114,7 @@ static void sdl_display_write_mono(u8_t *disp_buf,
114
114
u32_t one_color ;
115
115
u8_t * disp_buf_start ;
116
116
117
- __ASSERT ((desc -> pitch * desc -> height ) <= (8 * desc -> buf_size ),
117
+ __ASSERT ((desc -> pitch * desc -> height ) <= (desc -> buf_size * 8U ),
118
118
"Input buffer to small" );
119
119
__ASSERT ((desc -> height % 8 ) == 0U ,
120
120
"Input buffer height not aligned per 8 pixels" );
@@ -137,12 +137,12 @@ static void sdl_display_write_mono(u8_t *disp_buf,
137
137
pixel = (~one_color ) & 0x00FFFFFF ;
138
138
}
139
139
* ((u32_t * )disp_buf ) = pixel ;
140
- disp_buf += (4 * desc -> width );
140
+ disp_buf += (desc -> width * 4U );
141
141
}
142
142
disp_buf = disp_buf_start ;
143
143
disp_buf += 4 ;
144
144
}
145
- disp_buf += 7 * (4 * desc -> width );
145
+ disp_buf += 7 * (desc -> width * 4U );
146
146
}
147
147
}
148
148
@@ -207,11 +207,11 @@ static int sdl_display_read(const struct device *dev, const u16_t x,
207
207
desc -> height , x , y );
208
208
209
209
__ASSERT (desc -> width <= desc -> pitch , "Pitch is smaller then width" );
210
- __ASSERT ((3 * desc -> pitch * desc -> height ) <= desc -> buf_size ,
210
+ __ASSERT ((desc -> pitch * 3U * desc -> height ) <= desc -> buf_size ,
211
211
"Input buffer to small" );
212
212
213
213
return SDL_RenderReadPixels (disp_data -> renderer , & rect , 0 , buf ,
214
- 4 * desc -> pitch );
214
+ desc -> pitch * 4U );
215
215
}
216
216
217
217
static void * sdl_display_get_framebuffer (const struct device * dev )
0 commit comments