Fix compilation with -Werror=float-conversion

Better make the conversions explicit so that we don't get any surprises.

Fixes #4065
This commit is contained in:
Wim Taymans 2024-06-18 12:17:56 +02:00
parent 50870aac57
commit 1ae4374ccf
71 changed files with 286 additions and 284 deletions

View file

@ -123,18 +123,18 @@ static void on_process(void *userdata)
}
if ((mc = spa_buffer_find_meta_data(buf, SPA_META_VideoCrop, sizeof(*mc)))) {
data->crop = (sin(data->accumulator) + 1.0) * 32.0;
mc->region.position.x = data->crop;
mc->region.position.y = data->crop;
mc->region.size.width = data->position->video.size.width - data->crop*2;
mc->region.size.height = data->position->video.size.height - data->crop*2;
mc->region.position.x = (int32_t)data->crop;
mc->region.position.y = (int32_t)data->crop;
mc->region.size.width = data->position->video.size.width - (int32_t)(data->crop*2);
mc->region.size.height = data->position->video.size.height - (int32_t)(data->crop*2);
}
if ((mcs = spa_buffer_find_meta_data(buf, SPA_META_Cursor, sizeof(*mcs)))) {
struct spa_meta_bitmap *mb;
uint32_t *bitmap, color;
mcs->id = 1;
mcs->position.x = (sin(data->accumulator) + 1.0) * 160.0 + 80;
mcs->position.y = (cos(data->accumulator) + 1.0) * 100.0 + 50;
mcs->position.x = (int32_t)((sin(data->accumulator) + 1.0) * 160.0 + 80);
mcs->position.y = (int32_t)((cos(data->accumulator) + 1.0) * 100.0 + 50);
mcs->hotspot.x = 0;
mcs->hotspot.y = 0;
mcs->bitmap_offset = sizeof(struct spa_meta_cursor);
@ -147,7 +147,7 @@ static void on_process(void *userdata)
mb->offset = sizeof(struct spa_meta_bitmap);
bitmap = SPA_PTROFF(mb, mb->offset, uint32_t);
color = (cos(data->accumulator) + 1.0) * (1 << 23);
color = (uint32_t)((cos(data->accumulator) + 1.0) * (1 << 23));
color |= 0xff000000;
draw_elipse(bitmap, mb->size.width, mb->size.height, color);