meson: add -Wfloat-conversion

This commit is contained in:
Kirill Primak 2022-09-19 00:16:24 +03:00
parent 2ad25b1460
commit cf857ecf7b
31 changed files with 220 additions and 204 deletions

View file

@ -91,17 +91,17 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
wlr_renderer_begin(sample->renderer, wlr_output->width, wlr_output->height);
wlr_renderer_clear(sample->renderer, (float[]){0.25f, 0.25f, 0.25f, 1});
float distance = 0.8f * (1 - sample->distance);
float distance = 0.8f * (float)(1.0 - sample->distance);
float tool_color[4] = { distance, distance, distance, 1 };
for (size_t i = 0; sample->button && i < 4; ++i) {
tool_color[i] = sample->tool_color[i];
}
float scale = 4;
float pad_width = sample->width_mm * scale;
float pad_height = sample->height_mm * scale;
float left = width / 2.0f - pad_width / 2.0f;
float top = height / 2.0f - pad_height / 2.0f;
int pad_width = (int)(sample->width_mm * scale);
int pad_height = (int)(sample->height_mm * scale);
int left = (int)(width / 2.0f - pad_width / 2.0f);
int top = (int)(height / 2.0f - pad_height / 2.0f);
const struct wlr_box box = {
.x = left, .y = top,
.width = pad_width, .height = pad_height,
@ -111,18 +111,18 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
if (sample->proximity) {
struct wlr_box box = {
.x = (sample->x * pad_width) - 8 * (sample->pressure + 1) + left,
.y = (sample->y * pad_height) - 8 * (sample->pressure + 1) + top,
.width = 16 * (sample->pressure + 1),
.height = 16 * (sample->pressure + 1),
.x = (int)((sample->x * pad_width) - 8 * (sample->pressure + 1) + left),
.y = (int)((sample->y * pad_height) - 8 * (sample->pressure + 1) + top),
.width = (int)(16 * (sample->pressure + 1)),
.height = (int)(16 * (sample->pressure + 1)),
};
float matrix[9];
wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL,
sample->ring, wlr_output->transform_matrix);
(float)sample->ring, wlr_output->transform_matrix);
wlr_render_quad_with_matrix(sample->renderer, tool_color, matrix);
box.x += sample->x_tilt;
box.y += sample->y_tilt;
box.x += (int)sample->x_tilt;
box.y += (int)sample->y_tilt;
box.width /= 2;
box.height /= 2;
wlr_render_rect(sample->renderer, &box, tool_color,