1
0
Fork 0

Compile with -Wfloat-conversion

This means we'll get warnings whenever a floating point value looses
precision, e.g. gets implicitly casted to an integer. It also warns when
implicitly casting double's to float's, which arguably is less of a
problem, but there are no warning for just float/double to int.

This would have caught
https://gitlab.gnome.org/GNOME/mutter/-/issues/3530.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3822>
This commit is contained in:
Jonas Ådahl 2024-06-18 10:23:00 +02:00 committed by Sebastian Wick
parent d5bc883712
commit 422ee4515d
157 changed files with 1313 additions and 1161 deletions

View file

@ -558,10 +558,10 @@ cally_actor_get_extents (AtkComponent *component,
clutter_actor_get_abs_allocation_vertices (actor, verts); clutter_actor_get_abs_allocation_vertices (actor, verts);
clutter_actor_get_transformed_size (actor, &f_width, &f_height); clutter_actor_get_transformed_size (actor, &f_width, &f_height);
*x = verts[0].x; *x = (int) verts[0].x;
*y = verts[0].y; *y = (int) verts[0].y;
*width = ceilf (f_width); *width = (int) ceilf (f_width);
*height = ceilf (f_height); *height = (int) ceilf (f_height);
} }
static gint static gint
@ -575,7 +575,7 @@ cally_actor_get_mdi_zorder (AtkComponent *component)
cally_actor = CALLY_ACTOR(component); cally_actor = CALLY_ACTOR(component);
actor = CALLY_GET_CLUTTER_ACTOR (cally_actor); actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
return clutter_actor_get_z_position (actor); return (int) clutter_actor_get_z_position (actor);
} }
static gboolean static gboolean

View file

@ -1497,8 +1497,8 @@ static void cally_text_get_character_extents (AtkText *text,
} }
clutter_actor_get_abs_allocation_vertices (actor, verts); clutter_actor_get_abs_allocation_vertices (actor, verts);
x_window = verts[0].x; x_window = (int) verts[0].x;
y_window = verts[0].y; y_window = (int) verts[0].y;
clutter_text_get_layout_offsets (clutter_text, &x_layout, &y_layout); clutter_text_get_layout_offsets (clutter_text, &x_layout, &y_layout);
@ -2438,8 +2438,8 @@ _cally_misc_get_index_at_point (ClutterText *clutter_text,
clutter_text_get_layout_offsets (clutter_text, &x_layout, &y_layout); clutter_text_get_layout_offsets (clutter_text, &x_layout, &y_layout);
clutter_actor_get_abs_allocation_vertices (CLUTTER_ACTOR (clutter_text), verts); clutter_actor_get_abs_allocation_vertices (CLUTTER_ACTOR (clutter_text), verts);
x_window = verts[0].x; x_window = (int) verts[0].x;
y_window = verts[0].y; y_window = (int) verts[0].y;
x_temp = x - x_layout - x_window; x_temp = x - x_layout - x_window;
y_temp = y - y_layout - y_window; y_temp = y - y_layout - y_window;

View file

@ -393,10 +393,10 @@ clutter_actor_box_interpolate (const ClutterActorBox *initial,
g_return_if_fail (final != NULL); g_return_if_fail (final != NULL);
g_return_if_fail (result != NULL); g_return_if_fail (result != NULL);
result->x1 = initial->x1 + (final->x1 - initial->x1) * progress; result->x1 = (float) (initial->x1 + (final->x1 - initial->x1) * progress);
result->y1 = initial->y1 + (final->y1 - initial->y1) * progress; result->y1 = (float) (initial->y1 + (final->y1 - initial->y1) * progress);
result->x2 = initial->x2 + (final->x2 - initial->x2) * progress; result->x2 = (float) (initial->x2 + (final->x2 - initial->x2) * progress);
result->y2 = initial->y2 + (final->y2 - initial->y2) * progress; result->y2 = (float) (initial->y2 + (final->y2 - initial->y2) * progress);
} }
/** /**
@ -539,8 +539,8 @@ _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
* here is 1.75px in total if you consider that the 0.75 padding could * here is 1.75px in total if you consider that the 0.75 padding could
* just cross an integer boundary and so ceil will effectively add 1. * just cross an integer boundary and so ceil will effectively add 1.
*/ */
box->x2 = ceilf (box->x2 + 0.75); box->x2 = ceilf (box->x2 + 0.75f);
box->y2 = ceilf (box->y2 + 0.75); box->y2 = ceilf (box->y2 + 0.75f);
/* Now we redefine the top-left relative to the bottom right based on the /* Now we redefine the top-left relative to the bottom right based on the
* rounded width/height determined above + a constant so that the overall * rounded width/height determined above + a constant so that the overall

View file

@ -2827,16 +2827,33 @@ clutter_actor_real_apply_transform (ClutterActor *self,
} }
if (info->rx_angle) if (info->rx_angle)
graphene_matrix_rotate (matrix, info->rx_angle, graphene_vec3_x_axis ()); {
graphene_matrix_rotate (matrix,
(float) info->rx_angle,
graphene_vec3_x_axis ());
}
if (info->ry_angle) if (info->ry_angle)
graphene_matrix_rotate (matrix, info->ry_angle, graphene_vec3_y_axis ()); {
graphene_matrix_rotate (matrix,
(float) info->ry_angle,
graphene_vec3_y_axis ());
}
if (info->rz_angle) if (info->rz_angle)
graphene_matrix_rotate (matrix, info->rz_angle, graphene_vec3_z_axis ()); {
graphene_matrix_rotate (matrix,
(float) info->rz_angle,
graphene_vec3_z_axis ());
}
if (info->scale_x != 1.0 || info->scale_y != 1.0 || info->scale_z != 1.0) if (info->scale_x != 1.0 || info->scale_y != 1.0 || info->scale_z != 1.0)
graphene_matrix_scale (matrix, info->scale_x, info->scale_y, info->scale_z); {
graphene_matrix_scale (matrix,
(float) info->scale_x,
(float) info->scale_y,
(float) info->scale_z);
}
/* basic translation: :allocation's origin and :z-position; instead /* basic translation: :allocation's origin and :z-position; instead
* of decomposing the pivot and translation info separate operations, * of decomposing the pivot and translation info separate operations,
@ -12288,8 +12305,8 @@ clutter_actor_transform_stage_point (ClutterActor *self,
/* Keeping these as ints simplifies the multiplication (no significant /* Keeping these as ints simplifies the multiplication (no significant
* loss of precision here). * loss of precision here).
*/ */
du = ceilf (priv->allocation.x2 - priv->allocation.x1); du = (int) ceilf (priv->allocation.x2 - priv->allocation.x1);
dv = ceilf (priv->allocation.y2 - priv->allocation.y1); dv = (int) ceilf (priv->allocation.y2 - priv->allocation.y1);
if (du == 0 || dv == 0) if (du == 0 || dv == 0)
return FALSE; return FALSE;
@ -12380,9 +12397,9 @@ clutter_actor_transform_stage_point (ClutterActor *self,
* Now transform our point with the ST matrix; the notional w * Now transform our point with the ST matrix; the notional w
* coordinate is 1, hence the last part is simply added. * coordinate is 1, hence the last part is simply added.
*/ */
xf = x * ST[0][0] + y * ST[1][0] + ST[2][0]; xf = (float) (x * ST[0][0] + y * ST[1][0] + ST[2][0]);
yf = x * ST[0][1] + y * ST[1][1] + ST[2][1]; yf = (float) (x * ST[0][1] + y * ST[1][1] + ST[2][1]);
wf = x * ST[0][2] + y * ST[1][2] + ST[2][2]; wf = (float) (x * ST[0][2] + y * ST[1][2] + ST[2][2]);
if (x_out) if (x_out)
*x_out = xf / wf; *x_out = xf / wf;
@ -12771,10 +12788,10 @@ clutter_actor_allocate_align_fill (ClutterActor *self,
x_align = 1.0 - x_align; x_align = 1.0 - x_align;
if (!x_fill) if (!x_fill)
allocation.x1 += ((available_width - child_width) * x_align); allocation.x1 += (float) ((available_width - child_width) * x_align);
if (!y_fill) if (!y_fill)
allocation.y1 += ((available_height - child_height) * y_align); allocation.y1 += (float) ((available_height - child_height) * y_align);
out: out:
@ -17267,7 +17284,7 @@ clutter_actor_get_content_box (ClutterActor *self,
case CLUTTER_CONTENT_GRAVITY_TOP: case CLUTTER_CONTENT_GRAVITY_TOP:
if (alloc_w > content_w) if (alloc_w > content_w)
{ {
box->x1 += ceilf ((alloc_w - content_w) / 2.0); box->x1 += ceilf ((alloc_w - content_w) / 2.0f);
box->x2 = box->x1 + content_w; box->x2 = box->x1 + content_w;
} }
box->y2 = box->y1 + MIN (content_h, alloc_h); box->y2 = box->y1 + MIN (content_h, alloc_h);
@ -17286,7 +17303,7 @@ clutter_actor_get_content_box (ClutterActor *self,
box->x2 = box->x1 + MIN (content_w, alloc_w); box->x2 = box->x1 + MIN (content_w, alloc_w);
if (alloc_h > content_h) if (alloc_h > content_h)
{ {
box->y1 += ceilf ((alloc_h - content_h) / 2.0); box->y1 += ceilf ((alloc_h - content_h) / 2.0f);
box->y2 = box->y1 + content_h; box->y2 = box->y1 + content_h;
} }
break; break;
@ -17294,12 +17311,12 @@ clutter_actor_get_content_box (ClutterActor *self,
case CLUTTER_CONTENT_GRAVITY_CENTER: case CLUTTER_CONTENT_GRAVITY_CENTER:
if (alloc_w > content_w) if (alloc_w > content_w)
{ {
box->x1 += ceilf ((alloc_w - content_w) / 2.0); box->x1 += ceilf ((alloc_w - content_w) / 2.0f);
box->x2 = box->x1 + content_w; box->x2 = box->x1 + content_w;
} }
if (alloc_h > content_h) if (alloc_h > content_h)
{ {
box->y1 += ceilf ((alloc_h - content_h) / 2.0); box->y1 += ceilf ((alloc_h - content_h) / 2.0f);
box->y2 = box->y1 + content_h; box->y2 = box->y1 + content_h;
} }
break; break;
@ -17312,7 +17329,7 @@ clutter_actor_get_content_box (ClutterActor *self,
} }
if (alloc_h > content_h) if (alloc_h > content_h)
{ {
box->y1 += ceilf ((alloc_h - content_h) / 2.0); box->y1 += ceilf ((alloc_h - content_h) / 2.0f);
box->y2 = box->y1 + content_h; box->y2 = box->y1 + content_h;
} }
break; break;
@ -17329,7 +17346,7 @@ clutter_actor_get_content_box (ClutterActor *self,
case CLUTTER_CONTENT_GRAVITY_BOTTOM: case CLUTTER_CONTENT_GRAVITY_BOTTOM:
if (alloc_w > content_w) if (alloc_w > content_w)
{ {
box->x1 += ceilf ((alloc_w - content_w) / 2.0); box->x1 += ceilf ((alloc_w - content_w) / 2.0f);
box->x2 = box->x1 + content_w; box->x2 = box->x1 + content_w;
} }
if (alloc_h > content_h) if (alloc_h > content_h)
@ -17365,16 +17382,16 @@ clutter_actor_get_content_box (ClutterActor *self,
box->y1 = 0.f; box->y1 = 0.f;
box->y2 = alloc_h; box->y2 = alloc_h;
box->x1 = (alloc_w - (alloc_h * r_c)) / 2.0f; box->x1 = (float) ((alloc_w - (alloc_h * r_c)) / 2.0);
box->x2 = box->x1 + (alloc_h * r_c); box->x2 = (float) (box->x1 + (alloc_h * r_c));
} }
else else
{ {
box->x1 = 0.f; box->x1 = 0.f;
box->x2 = alloc_w; box->x2 = alloc_w;
box->y1 = (alloc_h - (alloc_w / r_c)) / 2.0f; box->y1 = (float) ((alloc_h - (alloc_w / r_c)) / 2.0);
box->y2 = box->y1 + (alloc_w / r_c); box->y2 = (float) (box->y1 + (alloc_w / r_c));
} }
CLUTTER_NOTE (LAYOUT, CLUTTER_NOTE (LAYOUT,

View file

@ -582,7 +582,7 @@ clutter_align_constraint_set_factor (ClutterAlignConstraint *align,
{ {
g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align)); g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
align->factor = CLAMP (factor, 0.0, 1.0); align->factor = CLAMP (factor, 0.0f, 1.0f);
if (align->actor != NULL) if (align->actor != NULL)
clutter_actor_queue_relayout (align->actor); clutter_actor_queue_relayout (align->actor);

View file

@ -242,8 +242,8 @@ create_fbo (ClutterBlur *blur,
scaled_height = floorf (height / blur->downscale_factor); scaled_height = floorf (height / blur->downscale_factor);
pass->texture = cogl_texture_2d_new_with_size (ctx, pass->texture = cogl_texture_2d_new_with_size (ctx,
scaled_width, (int) scaled_width,
scaled_height); (int) scaled_height);
if (!pass->texture) if (!pass->texture)
return FALSE; return FALSE;
@ -354,19 +354,19 @@ clutter_blur_new (CoglTexture *texture,
BlurPass *vpass; BlurPass *vpass;
g_return_val_if_fail (texture != NULL, NULL); g_return_val_if_fail (texture != NULL, NULL);
g_return_val_if_fail (radius >= 0.0, NULL); g_return_val_if_fail (radius >= 0.0f, NULL);
width = cogl_texture_get_width (texture); width = cogl_texture_get_width (texture);
height = cogl_texture_get_height (texture); height = cogl_texture_get_height (texture);
blur = g_new0 (ClutterBlur, 1); blur = g_new0 (ClutterBlur, 1);
blur->sigma = radius / 2.0; blur->sigma = radius / 2.0f;
blur->source_texture = g_object_ref (texture); blur->source_texture = g_object_ref (texture);
blur->downscale_factor = calculate_downscale_factor (width, blur->downscale_factor = calculate_downscale_factor (width,
height, height,
blur->sigma); blur->sigma);
if (G_APPROX_VALUE (blur->sigma, 0.0, FLT_EPSILON)) if (G_APPROX_VALUE (blur->sigma, 0.0f, FLT_EPSILON))
goto out; goto out;
vpass = &blur->pass[VERTICAL]; vpass = &blur->pass[VERTICAL];

View file

@ -519,12 +519,12 @@ compare_gap (gconstpointer p1,
const guint *c1 = p1; const guint *c1 = p1;
const guint *c2 = p2; const guint *c2 = p2;
const gint d1 = MAX (sizes[*c1].natural_size - const int d1 = (int) MAX (sizes[*c1].natural_size -
sizes[*c1].minimum_size, sizes[*c1].minimum_size,
0); 0);
const gint d2 = MAX (sizes[*c2].natural_size - const int d2 = (int) MAX (sizes[*c2].natural_size -
sizes[*c2].minimum_size, sizes[*c2].minimum_size,
0); 0);
gint delta = (d2 - d1); gint delta = (d2 - d1);
@ -601,7 +601,7 @@ distribute_natural_allocation (float extra_space,
* Sort order and reducing remaining space by assigned space * Sort order and reducing remaining space by assigned space
* ensures that space is distributed equally. * ensures that space is distributed equally.
*/ */
float glue = (extra_space + i) / (i + 1.0); float glue = (extra_space + i) / (i + 1.0f);
float gap = float gap =
sizes[(spreading[i])].natural_size - sizes[(spreading[i])].minimum_size; sizes[(spreading[i])].natural_size - sizes[(spreading[i])].minimum_size;
@ -654,9 +654,9 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
sizes = g_newa (RequestedSize, nvis_children); sizes = g_newa (RequestedSize, nvis_children);
if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL) if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
size = box->y2 - box->y1 - (nvis_children - 1) * priv->spacing; size = (int) (box->y2 - box->y1 - (nvis_children - 1) * priv->spacing);
else else
size = box->x2 - box->x1 - (nvis_children - 1) * priv->spacing; size = (int) (box->x2 - box->x1 - (nvis_children - 1) * priv->spacing);
actor = CLUTTER_ACTOR (container); actor = CLUTTER_ACTOR (container);
@ -710,7 +710,7 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
? box->x2 - box->x1 ? box->x2 - box->x1
: box->y2 - box->y1); : box->y2 - box->y1);
size -= sizes[i].minimum_size; size -= (int) sizes[i].minimum_size;
sizes[i].actor = child; sizes[i].actor = child;
@ -723,9 +723,9 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
* minimum sizes for children that are not going to fill * minimum sizes for children that are not going to fill
*/ */
if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL) if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
size = box->y2 - box->y1 - (nvis_children - 1) * priv->spacing; size = (int) (box->y2 - box->y1 - (nvis_children - 1) * priv->spacing);
else else
size = box->x2 - box->x1 - (nvis_children - 1) * priv->spacing; size = (int) (box->x2 - box->x1 - (nvis_children - 1) * priv->spacing);
extra = size / nvis_children; extra = size / nvis_children;
n_extra_widgets = size % nvis_children; n_extra_widgets = size % nvis_children;
@ -763,14 +763,14 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL) if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
{ {
child_allocation.x1 = box->x1; child_allocation.x1 = box->x1;
child_allocation.x2 = MAX (1.0, box->x2); child_allocation.x2 = MAX (1.0f, box->x2);
y = box->y1; y = (int) box->y1;
} }
else else
{ {
child_allocation.y1 = box->y1; child_allocation.y1 = box->y1;
child_allocation.y2 = MAX (1.0, box->y2); child_allocation.y2 = MAX (1.0f, box->y2);
x = box->x1; x = (int) box->x1;
} }
i = 0; i = 0;
@ -814,7 +814,7 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
if (clutter_actor_needs_expand (child, priv->orientation)) if (clutter_actor_needs_expand (child, priv->orientation))
{ {
child_allocation.y1 = y; child_allocation.y1 = y;
child_allocation.y2 = child_allocation.y1 + MAX (1.0, child_size); child_allocation.y2 = child_allocation.y1 + MAX (1.0f, child_size);
} }
else else
{ {
@ -822,14 +822,14 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
child_allocation.y2 = child_allocation.y1 + sizes[i].minimum_size; child_allocation.y2 = child_allocation.y1 + sizes[i].minimum_size;
} }
y += child_size + priv->spacing; y += (int) (child_size + priv->spacing);
} }
else /* CLUTTER_ORIENTATION_HORIZONTAL */ else /* CLUTTER_ORIENTATION_HORIZONTAL */
{ {
if (clutter_actor_needs_expand (child, priv->orientation)) if (clutter_actor_needs_expand (child, priv->orientation))
{ {
child_allocation.x1 = x; child_allocation.x1 = x;
child_allocation.x2 = child_allocation.x1 + MAX (1.0, child_size); child_allocation.x2 = child_allocation.x1 + MAX (1.0f, child_size);
} }
else else
{ {
@ -837,7 +837,7 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
child_allocation.x2 = child_allocation.x1 + sizes[i].minimum_size; child_allocation.x2 = child_allocation.x1 + sizes[i].minimum_size;
} }
x += child_size + priv->spacing; x += (int) (child_size + priv->spacing);
if (is_rtl) if (is_rtl)
{ {

View file

@ -204,9 +204,9 @@ clutter_brightness_contrast_effect_get_property (GObject *gobject,
{ {
case PROP_BRIGHTNESS: case PROP_BRIGHTNESS:
{ {
color.red = (priv->brightness_red + 1.0f) * 127.0f; color.red = (uint8_t) ((priv->brightness_red + 1.0f) * 127.0f);
color.green = (priv->brightness_green + 1.0f) * 127.0f; color.green = (uint8_t) ((priv->brightness_green + 1.0f) * 127.0f);
color.blue = (priv->brightness_blue + 1.0f) * 127.0f; color.blue = (uint8_t) ((priv->brightness_blue + 1.0f) * 127.0f);
color.alpha = 0xff; color.alpha = 0xff;
cogl_value_set_color (value, &color); cogl_value_set_color (value, &color);
@ -215,9 +215,9 @@ clutter_brightness_contrast_effect_get_property (GObject *gobject,
case PROP_CONTRAST: case PROP_CONTRAST:
{ {
color.red = (priv->contrast_red + 1.0f) * 127.0f; color.red = (uint8_t) ((priv->contrast_red + 1.0f) * 127.0f);
color.green = (priv->contrast_green + 1.0f) * 127.0f; color.green = (uint8_t) ((priv->contrast_green + 1.0f) * 127.0f);
color.blue = (priv->contrast_blue + 1.0f) * 127.0f; color.blue = (uint8_t) ((priv->contrast_blue + 1.0f) * 127.0f);
color.alpha = 0xff; color.alpha = 0xff;
cogl_value_set_color (value, &color); cogl_value_set_color (value, &color);
@ -337,9 +337,9 @@ update_uniforms (ClutterBrightnessContrastEffect *self)
if (priv->contrast_uniform > -1) if (priv->contrast_uniform > -1)
{ {
float contrast[3] = { float contrast[3] = {
tan ((priv->contrast_red + 1) * G_PI_4), (float) tan ((priv->contrast_red + 1) * G_PI_4),
tan ((priv->contrast_green + 1) * G_PI_4), (float) tan ((priv->contrast_green + 1) * G_PI_4),
tan ((priv->contrast_blue + 1) * G_PI_4) (float) tan ((priv->contrast_blue + 1) * G_PI_4)
}; };
cogl_pipeline_set_uniform_float (priv->pipeline, cogl_pipeline_set_uniform_float (priv->pipeline,

View file

@ -188,9 +188,9 @@ update_tint_uniform (ClutterColorizeEffect *self)
if (priv->tint_uniform > -1) if (priv->tint_uniform > -1)
{ {
float tint[3] = { float tint[3] = {
priv->tint.red / 255.0, priv->tint.red / 255.0f,
priv->tint.green / 255.0, priv->tint.green / 255.0f,
priv->tint.blue / 255.0 priv->tint.blue / 255.0f,
}; };
cogl_pipeline_set_uniform_float (priv->pipeline, cogl_pipeline_set_uniform_float (priv->pipeline,

View file

@ -27,7 +27,7 @@
/** /**
* ClutterDeformEffect: * ClutterDeformEffect:
* *
* A base class for effects deforming the geometry of an actor * A base class for effects deforming the geometry of an actor
* *
* #ClutterDeformEffect is an abstract class providing all the plumbing * #ClutterDeformEffect is an abstract class providing all the plumbing
@ -237,7 +237,8 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
vertex.y = height * vertex.ty; vertex.y = height * vertex.ty;
vertex.z = 0.0f; vertex.z = 0.0f;
cogl_color_init_from_4f (&vertex.color, 1.0, 1.0, 1.0, opacity / 255.0); cogl_color_init_from_4f (&vertex.color,
1.0f, 1.0f, 1.0f, opacity / 255.0f);
clutter_deform_effect_deform_vertex (self, clutter_deform_effect_deform_vertex (self,
width, height, width, height,
@ -250,10 +251,10 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
vertex_out->z = vertex.z; vertex_out->z = vertex.z;
vertex_out->s = vertex.tx; vertex_out->s = vertex.tx;
vertex_out->t = vertex.ty; vertex_out->t = vertex.ty;
vertex_out->r = cogl_color_get_red (&vertex.color) * 255.0; vertex_out->r = (uint8_t) (cogl_color_get_red (&vertex.color) * 255.0f);
vertex_out->g = cogl_color_get_green (&vertex.color) * 255.0; vertex_out->g = (uint8_t) (cogl_color_get_green (&vertex.color) * 255.0f);
vertex_out->b = cogl_color_get_blue (&vertex.color) * 255.0; vertex_out->b = (uint8_t) (cogl_color_get_blue (&vertex.color) * 255.0f);
vertex_out->a = cogl_color_get_alpha (&vertex.color) * 255.0; vertex_out->a = (uint8_t) (cogl_color_get_alpha (&vertex.color) * 255.0f);
} }
} }

View file

@ -172,7 +172,7 @@ update_factor_uniform (ClutterDesaturateEffect *self)
if (priv->factor_uniform > -1) if (priv->factor_uniform > -1)
cogl_pipeline_set_uniform_1f (priv->pipeline, cogl_pipeline_set_uniform_1f (priv->pipeline,
priv->factor_uniform, priv->factor_uniform,
priv->factor); (float) priv->factor);
} }
static void static void

View file

@ -82,10 +82,10 @@ clutter_fixed_layout_get_preferred_width (ClutterLayoutManager *manager,
} }
if (min_width_p) if (min_width_p)
*min_width_p = min_right; *min_width_p = (float) min_right;
if (nat_width_p) if (nat_width_p)
*nat_width_p = natural_right; *nat_width_p = (float) natural_right;
} }
static void static void
@ -127,10 +127,10 @@ clutter_fixed_layout_get_preferred_height (ClutterLayoutManager *manager,
} }
if (min_height_p) if (min_height_p)
*min_height_p = min_bottom; *min_height_p = (float) min_bottom;
if (nat_height_p) if (nat_height_p)
*nat_height_p = natural_bottom; *nat_height_p = (float) natural_bottom;
} }
static void static void

View file

@ -130,8 +130,8 @@ get_columns (ClutterFlowLayout *self,
if (self->col_width == 0) if (self->col_width == 0)
return 1; return 1;
n_columns = (gint) (for_width + self->col_spacing) n_columns = (int) ((int) (for_width + self->col_spacing) /
/ (self->col_width + self->col_spacing); (self->col_width + self->col_spacing));
if (n_columns == 0) if (n_columns == 0)
return 1; return 1;
@ -151,8 +151,8 @@ get_rows (ClutterFlowLayout *self,
if (self->row_height == 0) if (self->row_height == 0)
return 1; return 1;
n_rows = (gint) (for_height + self->row_spacing) n_rows = (int) ((int) (for_height + self->row_spacing) /
/ (self->row_height + self->row_spacing); (self->row_height + self->row_spacing));
if (n_rows == 0) if (n_rows == 0)
return 1; return 1;
@ -714,10 +714,10 @@ clutter_flow_layout_allocate (ClutterLayoutManager *manager,
line_index, line_item_count + 1, items_per_line, line_index, line_item_count + 1, items_per_line,
item_x, item_y, item_width, item_height); item_x, item_y, item_width, item_height);
child_alloc.x1 = ceil (item_x); child_alloc.x1 = ceilf (item_x);
child_alloc.y1 = ceil (item_y); child_alloc.y1 = ceilf (item_y);
child_alloc.x2 = ceil (child_alloc.x1 + item_width); child_alloc.x2 = ceilf (child_alloc.x1 + item_width);
child_alloc.y2 = ceil (child_alloc.y1 + item_height); child_alloc.y2 = ceilf (child_alloc.y1 + item_height);
clutter_actor_allocate (child, &child_alloc); clutter_actor_allocate (child, &child_alloc);
if (self->orientation == CLUTTER_ORIENTATION_HORIZONTAL) if (self->orientation == CLUTTER_ORIENTATION_HORIZONTAL)

View file

@ -42,7 +42,7 @@ enum
static guint signals[N_SIGNALS]; static guint signals[N_SIGNALS];
#define SYNC_DELAY_FALLBACK_FRACTION 0.875 #define SYNC_DELAY_FALLBACK_FRACTION 0.875f
#define MINIMUM_REFRESH_RATE 30.f #define MINIMUM_REFRESH_RATE 30.f
@ -459,7 +459,7 @@ clutter_frame_clock_compute_max_render_time_us (ClutterFrameClock *frame_clock)
if (!frame_clock->ever_got_measurements || if (!frame_clock->ever_got_measurements ||
G_UNLIKELY (clutter_paint_debug_flags & G_UNLIKELY (clutter_paint_debug_flags &
CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME)) CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME))
return refresh_interval_us * SYNC_DELAY_FALLBACK_FRACTION; return (int64_t) (refresh_interval_us * SYNC_DELAY_FALLBACK_FRACTION);
/* Max render time shows how early the frame clock needs to be dispatched /* Max render time shows how early the frame clock needs to be dispatched
* to make it to the predicted next presentation time. It is an estimate of * to make it to the predicted next presentation time. It is an estimate of

View file

@ -26,7 +26,7 @@
/** /**
* ClutterGestureAction: * ClutterGestureAction:
* *
* Action for gesture gestures * Action for gesture gestures
* *
* #ClutterGestureAction is a sub-class of [class@Action] that implements * #ClutterGestureAction is a sub-class of [class@Action] that implements
@ -960,7 +960,7 @@ clutter_gesture_action_get_motion_delta (ClutterGestureAction *action,
if (delta_y) if (delta_y)
*delta_y = d_y; *delta_y = d_y;
return sqrt ((d_x * d_x) + (d_y * d_y)); return sqrtf ((d_x * d_x) + (d_y * d_y));
} }
/** /**

View file

@ -632,15 +632,15 @@ clutter_grid_request_spanning (ClutterGridRequest *request,
compute_request_for_child (request, child, orientation, contextual, compute_request_for_child (request, child, orientation, contextual,
&minimum, &natural); &minimum, &natural);
span_minimum = (attach->span - 1) * linedata->spacing; span_minimum = (int) ((attach->span - 1) * linedata->spacing);
span_natural = (attach->span - 1) * linedata->spacing; span_natural = (int) ((attach->span - 1) * linedata->spacing);
span_expand = 0; span_expand = 0;
force_expand = FALSE; force_expand = FALSE;
for (i = 0; i < attach->span; i++) for (i = 0; i < attach->span; i++)
{ {
line = &lines->lines[attach->pos - lines->min + i]; line = &lines->lines[attach->pos - lines->min + i];
span_minimum += line->minimum; span_minimum += (int) line->minimum;
span_natural += line->natural; span_natural += (int) line->natural;
if (line->expand) if (line->expand)
span_expand += 1; span_expand += 1;
} }
@ -665,7 +665,7 @@ clutter_grid_request_spanning (ClutterGridRequest *request,
{ {
gint total, m; gint total, m;
total = minimum - (attach->span - 1) * linedata->spacing; total = (int) (minimum - (attach->span - 1) * linedata->spacing);
m = total / attach->span + (total % attach->span ? 1 : 0); m = total / attach->span + (total % attach->span ? 1 : 0);
for (i = 0; i < attach->span; i++) for (i = 0; i < attach->span; i++)
{ {
@ -675,7 +675,7 @@ clutter_grid_request_spanning (ClutterGridRequest *request,
} }
else else
{ {
extra = minimum - span_minimum; extra = (int) (minimum - span_minimum);
expand = span_expand; expand = span_expand;
for (i = 0; i < attach->span; i++) for (i = 0; i < attach->span; i++)
{ {
@ -697,7 +697,7 @@ clutter_grid_request_spanning (ClutterGridRequest *request,
{ {
gint total, n; gint total, n;
total = natural - (attach->span - 1) * linedata->spacing; total = (int) (natural - (attach->span - 1) * linedata->spacing);
n = total / attach->span + (total % attach->span ? 1 : 0); n = total / attach->span + (total % attach->span ? 1 : 0);
for (i = 0; i < attach->span; i++) for (i = 0; i < attach->span; i++)
{ {
@ -707,7 +707,7 @@ clutter_grid_request_spanning (ClutterGridRequest *request,
} }
else else
{ {
extra = natural - span_natural; extra = (int) (natural - span_natural);
expand = span_expand; expand = span_expand;
for (i = 0; i < attach->span; i++) for (i = 0; i < attach->span; i++)
{ {
@ -903,12 +903,12 @@ compare_gap (gconstpointer p1,
const guint *c1 = p1; const guint *c1 = p1;
const guint *c2 = p2; const guint *c2 = p2;
const gint d1 = MAX (sizes[*c1].natural_size - const int d1 = (int) MAX (sizes[*c1].natural_size -
sizes[*c1].minimum_size, sizes[*c1].minimum_size,
0); 0);
const gint d2 = MAX (sizes[*c2].natural_size - const int d2 = (int) MAX (sizes[*c2].natural_size -
sizes[*c2].minimum_size, sizes[*c2].minimum_size,
0); 0);
gint delta = (d2 - d1); gint delta = (d2 - d1);
@ -985,8 +985,8 @@ distribute_natural_allocation (gint extra_space,
* ensures that space is distributed equally. * ensures that space is distributed equally.
*/ */
gint glue = (extra_space + i) / (i + 1); gint glue = (extra_space + i) / (i + 1);
gint gap = sizes[(spreading[i])].natural_size gint gap = (int) (sizes[(spreading[i])].natural_size -
- sizes[(spreading[i])].minimum_size; sizes[(spreading[i])].minimum_size);
gint extra = MIN (glue, gap); gint extra = MIN (glue, gap);
@ -1027,7 +1027,7 @@ clutter_grid_request_allocate (ClutterGridRequest *request,
linedata = &grid->linedata[orientation]; linedata = &grid->linedata[orientation];
lines = &request->lines[orientation]; lines = &request->lines[orientation];
size = total_size - (nonempty - 1) * linedata->spacing; size = (int) (total_size - (nonempty - 1) * linedata->spacing);
if (linedata->homogeneous) if (linedata->homogeneous)
{ {
@ -1059,7 +1059,7 @@ clutter_grid_request_allocate (ClutterGridRequest *request,
if (line->empty) if (line->empty)
continue; continue;
size -= line->minimum; size -= (int) line->minimum;
sizes[j].minimum_size = line->minimum; sizes[j].minimum_size = line->minimum;
sizes[j].natural_size = line->natural; sizes[j].natural_size = line->natural;
@ -1501,11 +1501,11 @@ clutter_grid_layout_get_property (GObject *gobject,
break; break;
case PROP_ROW_SPACING: case PROP_ROW_SPACING:
g_value_set_uint (value, COLUMNS (self)->spacing); g_value_set_uint (value, (int) COLUMNS (self)->spacing);
break; break;
case PROP_COLUMN_SPACING: case PROP_COLUMN_SPACING:
g_value_set_uint (value, ROWS (self)->spacing); g_value_set_uint (value, (int) ROWS (self)->spacing);
break; break;
case PROP_ROW_HOMOGENEOUS: case PROP_ROW_HOMOGENEOUS:
@ -1962,7 +1962,7 @@ clutter_grid_layout_get_row_spacing (ClutterGridLayout *layout)
{ {
g_return_val_if_fail (CLUTTER_IS_GRID_LAYOUT (layout), 0); g_return_val_if_fail (CLUTTER_IS_GRID_LAYOUT (layout), 0);
return COLUMNS (layout)->spacing; return (unsigned int) COLUMNS (layout)->spacing;
} }
/** /**
@ -2001,7 +2001,7 @@ clutter_grid_layout_get_column_spacing (ClutterGridLayout *layout)
{ {
g_return_val_if_fail (CLUTTER_IS_GRID_LAYOUT (layout), 0); g_return_val_if_fail (CLUTTER_IS_GRID_LAYOUT (layout), 0);
return ROWS (layout)->spacing; return (unsigned int) ROWS (layout)->spacing;
} }
/** /**

View file

@ -122,10 +122,14 @@ cogl_color_interpolate (const CoglColor *initial,
g_return_if_fail (final != NULL); g_return_if_fail (final != NULL);
g_return_if_fail (result != NULL); g_return_if_fail (result != NULL);
result->red = initial->red + (final->red - initial->red) * progress; result->red = (uint8_t) (initial->red +
result->green = initial->green + (final->green - initial->green) * progress; (final->red - initial->red) * progress);
result->blue = initial->blue + (final->blue - initial->blue) * progress; result->green = (uint8_t) (initial->green +
result->alpha = initial->alpha + (final->alpha - initial->alpha) * progress; (final->green - initial->green) * progress);
result->blue = (uint8_t) (initial->blue +
(final->blue - initial->blue) * progress);
result->alpha = (uint8_t) (initial->alpha +
(final->alpha - initial->alpha) * progress);
} }
static gboolean static gboolean

View file

@ -24,7 +24,7 @@
/** /**
* ClutterInterval: * ClutterInterval:
* *
* An object holding an interval of two values * An object holding an interval of two values
* *
* #ClutterInterval is a simple object that can hold two values * #ClutterInterval is a simple object that can hold two values
@ -262,7 +262,7 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
ia = g_value_get_int (initial); ia = g_value_get_int (initial);
ib = g_value_get_int (final); ib = g_value_get_int (final);
res = (factor * (ib - ia)) + ia; res = (int) ((factor * (ib - ia)) + ia);
g_value_set_int (value, res); g_value_set_int (value, res);
@ -277,7 +277,7 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
ia = g_value_get_schar (initial); ia = g_value_get_schar (initial);
ib = g_value_get_schar (final); ib = g_value_get_schar (final);
res = (factor * (ib - (gdouble) ia)) + ia; res = (int) ((factor * (ib - (gdouble) ia)) + ia);
g_value_set_schar (value, res); g_value_set_schar (value, res);
@ -292,7 +292,7 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
ia = g_value_get_uint (initial); ia = g_value_get_uint (initial);
ib = g_value_get_uint (final); ib = g_value_get_uint (final);
res = (factor * (ib - (gdouble) ia)) + ia; res = (unsigned int) ((factor * (ib - (gdouble) ia)) + ia);
g_value_set_uint (value, res); g_value_set_uint (value, res);
@ -307,7 +307,7 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
ia = g_value_get_uchar (initial); ia = g_value_get_uchar (initial);
ib = g_value_get_uchar (final); ib = g_value_get_uchar (final);
res = (factor * (ib - (gdouble) ia)) + ia; res = (unsigned int) ((factor * (ib - (gdouble) ia)) + ia);
g_value_set_uchar (value, res); g_value_set_uchar (value, res);
@ -336,7 +336,7 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
if (value_type == G_TYPE_DOUBLE) if (value_type == G_TYPE_DOUBLE)
g_value_set_double (value, res); g_value_set_double (value, res);
else else
g_value_set_float (value, res); g_value_set_float (value, (float) res);
retval = TRUE; retval = TRUE;
} }

View file

@ -25,7 +25,7 @@
/** /**
* ClutterOffscreenEffect: * ClutterOffscreenEffect:
* *
* Base class for effects using offscreen buffers * Base class for effects using offscreen buffers
* *
* #ClutterOffscreenEffect is an abstract class that can be used by * #ClutterOffscreenEffect is an abstract class that can be used by
@ -156,7 +156,9 @@ clutter_offscreen_effect_real_create_texture (ClutterOffscreenEffect *effect,
CoglContext *ctx = CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ()); clutter_backend_get_cogl_context (clutter_get_default_backend ());
return cogl_texture_2d_new_with_size (ctx, MAX (width, 1), MAX (height, 1)); return cogl_texture_2d_new_with_size (ctx,
(int) MAX (width, 1),
(int) MAX (height, 1));
} }
static void static void
@ -349,8 +351,8 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
box = raw_box; box = raw_box;
_clutter_actor_box_enlarge_for_effects (&box); _clutter_actor_box_enlarge_for_effects (&box);
priv->fbo_offset_x = box.x1; priv->fbo_offset_x = (int) box.x1;
priv->fbo_offset_y = box.y1; priv->fbo_offset_y = (int) box.y1;
} }
else else
{ {
@ -359,8 +361,8 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
box = raw_box; box = raw_box;
_clutter_actor_box_enlarge_for_effects (&box); _clutter_actor_box_enlarge_for_effects (&box);
priv->fbo_offset_x = box.x1 - raw_box.x1; priv->fbo_offset_x = (int) (box.x1 - raw_box.x1);
priv->fbo_offset_y = box.y1 - raw_box.y1; priv->fbo_offset_y = (int) (box.y1 - raw_box.y1);
} }
clutter_actor_box_scale (&box, ceiled_resource_scale); clutter_actor_box_scale (&box, ceiled_resource_scale);
@ -370,7 +372,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
target_height = ceilf (target_height); target_height = ceilf (target_height);
/* First assert that the framebuffer is the right size... */ /* First assert that the framebuffer is the right size... */
if (!update_fbo (effect, target_width, target_height, resource_scale)) if (!update_fbo (effect, (int) target_width, (int) target_height, resource_scale))
goto disable_effect; goto disable_effect;
offscreen = COGL_FRAMEBUFFER (priv->offscreen); offscreen = COGL_FRAMEBUFFER (priv->offscreen);
@ -427,7 +429,7 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
float paint_opacity; float paint_opacity;
CoglColor color; CoglColor color;
paint_opacity = clutter_actor_get_paint_opacity (priv->actor) / 255.0; paint_opacity = clutter_actor_get_paint_opacity (priv->actor) / 255.0f;
cogl_color_init_from_4f (&color, cogl_color_init_from_4f (&color,
paint_opacity, paint_opacity, paint_opacity, paint_opacity,
@ -464,12 +466,12 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
graphene_matrix_t transform; graphene_matrix_t transform;
float unscale; float unscale;
unscale = 1.0 / clutter_actor_get_resource_scale (priv->actor); unscale = 1.0f / clutter_actor_get_resource_scale (priv->actor);
graphene_matrix_init_scale (&transform, unscale, unscale, 1.0); graphene_matrix_init_scale (&transform, unscale, unscale, 1.0f);
graphene_matrix_translate (&transform, graphene_matrix_translate (&transform,
&GRAPHENE_POINT3D_INIT (priv->fbo_offset_x, &GRAPHENE_POINT3D_INIT (priv->fbo_offset_x,
priv->fbo_offset_y, priv->fbo_offset_y,
0.0)); 0.0f));
if (!graphene_matrix_is_identity (&transform)) if (!graphene_matrix_is_identity (&transform))
{ {

View file

@ -82,19 +82,19 @@ clutter_page_turn_effect_deform_vertex (ClutterDeformEffect *effect,
if (self->period == 0.0) if (self->period == 0.0)
return; return;
radians = self->angle / (180.0f / G_PI); radians = (float) (self->angle / (180.0f / G_PI));
/* Rotate the point around the centre of the page-curl ray to align it with /* Rotate the point around the centre of the page-curl ray to align it with
* the y-axis. * the y-axis.
*/ */
cx = (1.f - self->period) * width; cx = (float) (1.0f - self->period) * width;
cy = (1.f - self->period) * height; cy = (float) (1.0f - self->period) * height;
rx = ((vertex->x - cx) * cos (- radians)) rx = ((vertex->x - cx) * cosf (- radians))
- ((vertex->y - cy) * sin (- radians)) - ((vertex->y - cy) * sinf (- radians))
- self->radius; - self->radius;
ry = ((vertex->x - cx) * sin (- radians)) ry = ((vertex->x - cx) * sinf (- radians))
+ ((vertex->y - cy) * cos (- radians)); + ((vertex->y - cy) * cosf (- radians));
turn_angle = 0.f; turn_angle = 0.f;
if (rx > self->radius * -2.0f) if (rx > self->radius * -2.0f)
@ -102,13 +102,13 @@ clutter_page_turn_effect_deform_vertex (ClutterDeformEffect *effect,
/* Calculate the curl angle as a function from the distance of the curl /* Calculate the curl angle as a function from the distance of the curl
* ray (i.e. the page crease) * ray (i.e. the page crease)
*/ */
turn_angle = (rx / self->radius * G_PI_2) - G_PI_2; turn_angle = (float) ((rx / self->radius * G_PI_2) - G_PI_2);
shade = ((sin (turn_angle) * 96.0f) + 159.0f) / 255.0; shade = ((sinf (turn_angle) * 96.0f) + 159.0f) / 255.0f;
/* Add a gradient that makes it look like lighting and hides the switch /* Add a gradient that makes it look like lighting and hides the switch
* between textures. * between textures.
*/ */
cogl_color_init_from_4f (&vertex->color, shade, shade, shade, 1.0); cogl_color_init_from_4f (&vertex->color, shade, shade, shade, 1.0f);
} }
if (rx > 0) if (rx > 0)
@ -119,18 +119,18 @@ clutter_page_turn_effect_deform_vertex (ClutterDeformEffect *effect,
* between curled layers of the texture, in pixels. * between curled layers of the texture, in pixels.
*/ */
gfloat small_radius; gfloat small_radius;
small_radius = self->radius small_radius = (float) (self->radius -
- MIN (self->radius, (turn_angle * 10) / G_PI); MIN (self->radius, (turn_angle * 10) / G_PI));
/* Calculate a point on a cylinder (maybe make this a cone at some /* Calculate a point on a cylinder (maybe make this a cone at some
* point) and rotate it by the specified angle. * point) and rotate it by the specified angle.
*/ */
rx = (small_radius * cos (turn_angle)) + self->radius; rx = (small_radius * cosf (turn_angle)) + self->radius;
vertex->x = (rx * cos (radians)) - (ry * sin (radians)) + cx; vertex->x = (rx * cosf (radians)) - (ry * sinf (radians)) + cx;
vertex->y = (rx * sin (radians)) + (ry * cos (radians)) + cy; vertex->y = (rx * sinf (radians)) + (ry * cosf (radians)) + cy;
vertex->z = (small_radius * sin (turn_angle)) + self->radius; vertex->z = (small_radius * sinf (turn_angle)) + self->radius;
} }
} }

View file

@ -1352,12 +1352,12 @@ clutter_blit_node_draw (ClutterPaintNode *node,
cogl_blit_framebuffer (blit_node->src, cogl_blit_framebuffer (blit_node->src,
framebuffer, framebuffer,
op->op.texrect[0], (int) op->op.texrect[0],
op->op.texrect[1], (int) op->op.texrect[1],
op->op.texrect[4], (int) op->op.texrect[4],
op->op.texrect[5], (int) op->op.texrect[5],
op_width, (int) op_width,
op_height, (int) op_height,
&error); &error);
if (error) if (error)

View file

@ -32,7 +32,7 @@
/** /**
* ClutterPanAction: * ClutterPanAction:
* *
* Action for pan gestures * Action for pan gestures
* *
* #ClutterPanAction is a sub-class of [class@GestureAction] that implements * #ClutterPanAction is a sub-class of [class@GestureAction] that implements
@ -153,7 +153,7 @@ emit_pan (ClutterPanAction *self,
{ {
gfloat delta_x; gfloat delta_x;
gfloat delta_y; gfloat delta_y;
gfloat scroll_threshold = G_PI_4/2; gfloat scroll_threshold = (float) G_PI_4 / 2;
gfloat drag_angle; gfloat drag_angle;
clutter_gesture_action_get_motion_delta (CLUTTER_GESTURE_ACTION (self), clutter_gesture_action_get_motion_delta (CLUTTER_GESTURE_ACTION (self),
@ -164,7 +164,7 @@ emit_pan (ClutterPanAction *self,
if (delta_x != 0.0f) if (delta_x != 0.0f)
drag_angle = atanf (delta_y / delta_x); drag_angle = atanf (delta_y / delta_x);
else else
drag_angle = G_PI_2; drag_angle = (float) G_PI_2;
if ((drag_angle > -scroll_threshold) && if ((drag_angle > -scroll_threshold) &&
(drag_angle < scroll_threshold)) (drag_angle < scroll_threshold))
@ -218,8 +218,8 @@ on_deceleration_new_frame (ClutterTimeline *timeline,
progress = clutter_timeline_get_progress (timeline); progress = clutter_timeline_get_progress (timeline);
interpolated_x = priv->target_x * progress; interpolated_x = (float) (priv->target_x * progress);
interpolated_y = priv->target_y * progress; interpolated_y = (float) (priv->target_y * progress);
priv->dx = interpolated_x - priv->interpolated_x; priv->dx = interpolated_x - priv->interpolated_x;
priv->dy = interpolated_y - priv->interpolated_y; priv->dy = interpolated_y - priv->interpolated_y;
priv->interpolated_x = interpolated_x; priv->interpolated_x = interpolated_x;
@ -315,19 +315,19 @@ gesture_end (ClutterGestureAction *gesture,
* tau = 1000ms / (frame_per_second * - ln(decay_per_frame)) * tau = 1000ms / (frame_per_second * - ln(decay_per_frame))
* with frame_per_second = 60 and decay_per_frame = 0.95, tau ~= 325ms * with frame_per_second = 60 and decay_per_frame = 0.95, tau ~= 325ms
* see http://ariya.ofilabs.com/2011/10/flick-list-with-its-momentum-scrolling-and-deceleration.html */ * see http://ariya.ofilabs.com/2011/10/flick-list-with-its-momentum-scrolling-and-deceleration.html */
tau = 1000.0f / (reference_fps * - logf (priv->deceleration_rate)); tau = 1000.0f / (reference_fps * - logf ((float) priv->deceleration_rate));
/* See where the decreasing velocity reaches $min_velocity px/ms /* See where the decreasing velocity reaches $min_velocity px/ms
* v(t) = v(0) * exp(-t/tau) = min_velocity * v(t) = v(0) * exp(-t/tau) = min_velocity
* t = - tau * ln( min_velocity / |v(0)|) */ * t = - tau * ln( min_velocity / |v(0)|) */
duration = - tau * logf (min_velocity / (ABS (velocity) * duration = (int) (- tau * logf ((float) (min_velocity / (ABS (velocity) *
priv->acceleration_factor)); priv->acceleration_factor))));
/* Target point: x(t) = v(0) * tau * [1 - exp(-t/tau)] */ /* Target point: x(t) = v(0) * tau * [1 - exp(-t/tau)] */
priv->target_x = (velocity_x * priv->acceleration_factor * tau * priv->target_x = (float) (velocity_x * priv->acceleration_factor * tau *
(1 - exp ((float)-duration / tau))); (1 - exp ((float)-duration / tau)));
priv->target_y = (velocity_y * priv->acceleration_factor * tau * priv->target_y = (float) (velocity_y * priv->acceleration_factor * tau *
(1 - exp ((float)-duration / tau))); (1 - exp ((float)-duration / tau)));
if (ABS (velocity) * priv->acceleration_factor > min_velocity && if (ABS (velocity) * priv->acceleration_factor > min_velocity &&
duration > FLOAT_EPSILON) duration > FLOAT_EPSILON)
@ -847,7 +847,7 @@ clutter_pan_action_get_interpolated_delta (ClutterPanAction *self,
if (delta_y) if (delta_y)
*delta_y = priv->dy; *delta_y = priv->dy;
return sqrt ((priv->dx * priv->dx) + (priv->dy * priv->dy)); return sqrtf ((priv->dx * priv->dx) + (priv->dy * priv->dy));
} }
/** /**

View file

@ -444,10 +444,10 @@ get_verts_rectangle (graphene_point3d_t verts[4],
return FALSE; return FALSE;
*rect = (MtkRectangle) { *rect = (MtkRectangle) {
.x = ceilf (verts[0].x), .x = (int) ceilf (verts[0].x),
.y = ceilf (verts[0].y), .y = (int) ceilf (verts[0].y),
.width = floor (verts[1].x - ceilf (verts[0].x)), .width = (int) floor (verts[1].x - ceilf (verts[0].x)),
.height = floor (verts[2].y - ceilf (verts[0].y)), .height = (int) floor (verts[2].y - ceilf (verts[0].y)),
}; };
return TRUE; return TRUE;
@ -480,12 +480,14 @@ calculate_clear_area (ClutterPickStack *pick_stack,
return; return;
} }
rect.x += ceil (pick_rec->base.rect.x1); rect.x += (int) ceil (pick_rec->base.rect.x1);
rect.y += ceil (pick_rec->base.rect.y1); rect.y += (int) ceil (pick_rec->base.rect.y1);
rect.width = rect.width =
MIN (rect.width, floor (pick_rec->base.rect.x2 - pick_rec->base.rect.x1)); MIN (rect.width, (int) floor (pick_rec->base.rect.x2 -
pick_rec->base.rect.x1));
rect.height = rect.height =
MIN (rect.height, floor (pick_rec->base.rect.y2 - pick_rec->base.rect.y1)); MIN (rect.height, (int) floor (pick_rec->base.rect.y2 -
pick_rec->base.rect.y1));
area = mtk_region_create_rectangle (&rect); area = mtk_region_create_rectangle (&rect);
@ -494,6 +496,7 @@ calculate_clear_area (ClutterPickStack *pick_stack,
PickRecord *rec = PickRecord *rec =
&g_array_index (pick_stack->vertices_stack, PickRecord, i); &g_array_index (pick_stack->vertices_stack, PickRecord, i);
ClutterActorBox paint_box; ClutterActorBox paint_box;
MtkRectangle paint_box_rect;
if (!rec->is_overlap && if (!rec->is_overlap &&
(rec->base.rect.x1 == rec->base.rect.x2 || (rec->base.rect.x1 == rec->base.rect.x2 ||
@ -503,11 +506,11 @@ calculate_clear_area (ClutterPickStack *pick_stack,
if (!clutter_actor_get_paint_box (rec->actor, &paint_box)) if (!clutter_actor_get_paint_box (rec->actor, &paint_box))
continue; continue;
mtk_region_subtract_rectangle (area, paint_box_rect = MTK_RECTANGLE_INIT ((int) paint_box.x1,
&MTK_RECTANGLE_INIT (paint_box.x1, paint_box.y1, (int) paint_box.y1,
paint_box.x2 - paint_box.x1, (int) (paint_box.x2 - paint_box.x1),
paint_box.y2 - paint_box.y1) (int) (paint_box.y2 - paint_box.y1));
); mtk_region_subtract_rectangle (area, &paint_box_rect);
} }
if (clear_area) if (clear_area)

View file

@ -24,7 +24,7 @@
/** /**
* ClutterRotateAction: * ClutterRotateAction:
* *
* Action to rotate an actor * Action to rotate an actor
* *
* #ClutterRotateAction is a sub-class of [class@GestureAction] that implements * #ClutterRotateAction is a sub-class of [class@GestureAction] that implements
@ -116,9 +116,9 @@ clutter_rotate_action_gesture_progress (ClutterGestureAction *action,
/* Computes angle between the 2 initial touch points and the /* Computes angle between the 2 initial touch points and the
current position of the 2 touch points. */ current position of the 2 touch points. */
norm = sqrt (vector[0] * vector[0] + vector[1] * vector[1]); norm = sqrtf (vector[0] * vector[0] + vector[1] * vector[1]);
norm = (priv->initial_vector[0] * vector[0] + norm = (float) ((priv->initial_vector[0] * vector[0] +
priv->initial_vector[1] * vector[1]) / (priv->initial_vector_norm * norm); priv->initial_vector[1] * vector[1]) / (priv->initial_vector_norm * norm));
if ((norm >= -1.0) && (norm <= 1.0)) if ((norm >= -1.0) && (norm <= 1.0))
angle = acos (norm); angle = acos (norm);

View file

@ -475,11 +475,12 @@ sync_pointer_a11y_settings (ClutterSettings *self,
/* "secondary-click-time" is expressed in seconds */ /* "secondary-click-time" is expressed in seconds */
pointer_a11y_settings.secondary_click_delay = pointer_a11y_settings.secondary_click_delay =
(1000 * g_settings_get_double (self->mouse_a11y_settings, (int) (1000 * g_settings_get_double (self->mouse_a11y_settings,
"secondary-click-time")); "secondary-click-time"));
/* "dwell-time" is expressed in seconds */ /* "dwell-time" is expressed in seconds */
pointer_a11y_settings.dwell_delay = pointer_a11y_settings.dwell_delay =
(1000 * g_settings_get_double (self->mouse_a11y_settings, "dwell-time")); (int) (1000 * g_settings_get_double (self->mouse_a11y_settings,
"dwell-time"));
pointer_a11y_settings.dwell_threshold = pointer_a11y_settings.dwell_threshold =
g_settings_get_int (self->mouse_a11y_settings, "dwell-threshold"); g_settings_get_int (self->mouse_a11y_settings, "dwell-threshold");
@ -697,7 +698,7 @@ clutter_settings_get_property (GObject *gobject,
break; break;
case PROP_FONT_DPI: case PROP_FONT_DPI:
g_value_set_int (value, self->resolution * 1024); g_value_set_int (value, (int) (self->resolution * 1024));
break; break;
case PROP_FONT_HINTING: case PROP_FONT_HINTING:

View file

@ -252,12 +252,12 @@ paint_transformed_framebuffer (ClutterStageView *view,
cogl_framebuffer_push_matrix (dst_framebuffer); cogl_framebuffer_push_matrix (dst_framebuffer);
graphene_matrix_init_translate (&matrix, graphene_matrix_init_translate (&matrix,
&GRAPHENE_POINT3D_INIT (-dst_width / 2.0, &GRAPHENE_POINT3D_INIT (-dst_width / 2.0f,
-dst_height / 2.0, -dst_height / 2.0f,
0.f)); 0.f));
graphene_matrix_scale (&matrix, graphene_matrix_scale (&matrix,
1.0 / (dst_width / 2.0), 1.0f / (dst_width / 2.0f),
-1.0 / (dst_height / 2.0), -1.0f / (dst_height / 2.0f),
0.f); 0.f);
cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix); cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix);
cogl_framebuffer_set_viewport (dst_framebuffer, cogl_framebuffer_set_viewport (dst_framebuffer,
@ -827,17 +827,17 @@ end_frame_timing_measurement (ClutterStageView *view)
(now_us - priv->frame_timings.last_print_time_us) / (now_us - priv->frame_timings.last_print_time_us) /
(float) G_USEC_PER_SEC; (float) G_USEC_PER_SEC;
if (time_since_last_print_s >= 1.0) if (time_since_last_print_s >= 1.0f)
{ {
float avg_fps, avg_draw_time_ms, worst_draw_time_ms; float avg_fps, avg_draw_time_ms, worst_draw_time_ms;
avg_fps = priv->frame_timings.frame_count / time_since_last_print_s; avg_fps = priv->frame_timings.frame_count / time_since_last_print_s;
avg_draw_time_ms = avg_draw_time_ms =
(priv->frame_timings.cumulative_draw_time_us / 1000.0) / (priv->frame_timings.cumulative_draw_time_us / 1000.0f) /
priv->frame_timings.frame_count; priv->frame_timings.frame_count;
worst_draw_time_ms = priv->frame_timings.worst_draw_time_us / 1000.0; worst_draw_time_ms = priv->frame_timings.worst_draw_time_us / 1000.0f;
g_print ("*** %s frame timings over %.01fs: " g_print ("*** %s frame timings over %.01fs: "
"%.02f FPS, average: %.01fms, peak: %.01fms\n", "%.02f FPS, average: %.01fms, peak: %.01fms\n",

View file

@ -686,11 +686,12 @@ clutter_stage_compress_motion (ClutterStage *stage,
clutter_event_get_device_tool (event), clutter_event_get_device_tool (event),
clutter_event_get_state (event), clutter_event_get_state (event),
coords, coords,
GRAPHENE_POINT_INIT (dx + dst_dx, dy + dst_dy), GRAPHENE_POINT_INIT ((float) (dx + dst_dx),
GRAPHENE_POINT_INIT (dx_unaccel + dst_dx_unaccel, (float) (dy + dst_dy)),
dy_unaccel + dst_dy_unaccel), GRAPHENE_POINT_INIT ((float) (dx_unaccel + dst_dx_unaccel),
GRAPHENE_POINT_INIT (dx_constrained + dst_dx_constrained, (float) (dy_unaccel + dst_dy_unaccel)),
dy_constrained + dst_dy_constrained), GRAPHENE_POINT_INIT ((float) (dx_constrained + dst_dx_constrained),
(float) (dy_constrained + dst_dy_constrained)),
NULL); NULL);
} }
@ -1927,10 +1928,10 @@ clutter_stage_read_pixels (ClutterStage *stage,
clutter_actor_get_allocation_box (CLUTTER_ACTOR (stage), &box); clutter_actor_get_allocation_box (CLUTTER_ACTOR (stage), &box);
if (width < 0) if (width < 0)
width = ceilf (box.x2 - box.x1); width = (int) ceilf (box.x2 - box.x1);
if (height < 0) if (height < 0)
height = ceilf (box.y2 - box.y1); height = (int) ceilf (box.y2 - box.y1);
l = _clutter_stage_window_get_views (priv->impl); l = _clutter_stage_window_get_views (priv->impl);
@ -1957,11 +1958,12 @@ clutter_stage_read_pixels (ClutterStage *stage,
pixel_width = roundf (clip_rect.width * view_scale); pixel_width = roundf (clip_rect.width * view_scale);
pixel_height = roundf (clip_rect.height * view_scale); pixel_height = roundf (clip_rect.height * view_scale);
pixels = g_malloc0 (pixel_width * pixel_height * 4); pixels = g_malloc0 ((int) (pixel_width * pixel_height * 4));
cogl_framebuffer_read_pixels (framebuffer, cogl_framebuffer_read_pixels (framebuffer,
clip_rect.x * view_scale, (int) (clip_rect.x * view_scale),
clip_rect.y * view_scale, (int) (clip_rect.y * view_scale),
pixel_width, pixel_height, (int) pixel_width,
(int) pixel_height,
COGL_PIXEL_FORMAT_RGBA_8888, COGL_PIXEL_FORMAT_RGBA_8888,
pixels); pixels);
@ -2332,7 +2334,7 @@ view_2d_in_perspective (graphene_matrix_t *matrix,
float width_2d, float width_2d,
float height_2d) float height_2d)
{ {
float top = z_near * tan (fov_y * G_PI / 360.0); float top = z_near * tanf ((float) (fov_y * G_PI / 360.0f));
float left = -top * aspect; float left = -top * aspect;
float right = top * aspect; float right = top * aspect;
float bottom = -top; float bottom = -top;
@ -2559,10 +2561,10 @@ clutter_stage_add_to_redraw_clip (ClutterStage *stage,
intersection_box.y2 <= intersection_box.y1) intersection_box.y2 <= intersection_box.y1)
return; return;
stage_clip.x = intersection_box.x1; stage_clip.x = (int) intersection_box.x1;
stage_clip.y = intersection_box.y1; stage_clip.y = (int) intersection_box.y1;
stage_clip.width = intersection_box.x2 - stage_clip.x; stage_clip.width = (int) (intersection_box.x2 - stage_clip.x);
stage_clip.height = intersection_box.y2 - stage_clip.y; stage_clip.height = (int) (intersection_box.y2 - stage_clip.y);
clutter_stage_add_redraw_clip (stage, &stage_clip); clutter_stage_add_redraw_clip (stage, &stage_clip);
} }
@ -2859,14 +2861,17 @@ clutter_stage_capture_view_into (ClutterStage *stage,
backend = clutter_get_default_backend (); backend = clutter_get_default_backend ();
context = clutter_backend_get_cogl_context (backend); context = clutter_backend_get_cogl_context (backend);
bitmap = cogl_bitmap_new_for_data (context, bitmap = cogl_bitmap_new_for_data (context,
texture_width, texture_height, (int) texture_width,
(int) texture_height,
COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT, COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT,
stride, stride,
data); data);
cogl_framebuffer_read_pixels_into_bitmap (framebuffer, cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
roundf ((rect->x - view_layout.x) * view_scale), (int) roundf ((rect->x -
roundf ((rect->y - view_layout.y) * view_scale), view_layout.x) * view_scale),
(int) roundf ((rect->y -
view_layout.y) * view_scale),
COGL_READ_PIXELS_COLOR_BUFFER, COGL_READ_PIXELS_COLOR_BUFFER,
bitmap); bitmap);
@ -3512,7 +3517,7 @@ clutter_stage_check_in_clear_area (ClutterStage *stage,
return FALSE; return FALSE;
return mtk_region_contains_point (entry->clear_area, return mtk_region_contains_point (entry->clear_area,
point.x, point.y); (int) point.x, (int) point.y);
} }
static ClutterActor * static ClutterActor *

View file

@ -591,7 +591,7 @@ ensure_effective_pango_scale_attribute (ClutterText *self)
scale_attrib = pango_attr_iterator_get (iter, PANGO_ATTR_SCALE); scale_attrib = pango_attr_iterator_get (iter, PANGO_ATTR_SCALE);
if (scale_attrib != NULL) if (scale_attrib != NULL)
resource_scale *= ((PangoAttrFloat *) scale_attrib)->value; resource_scale *= (float) ((PangoAttrFloat *) scale_attrib)->value;
pango_attr_iterator_destroy (iter); pango_attr_iterator_destroy (iter);
} }
@ -963,7 +963,7 @@ clutter_text_create_layout (ClutterText *text,
!((priv->editable && priv->single_line_mode) || !((priv->editable && priv->single_line_mode) ||
(priv->ellipsize == PANGO_ELLIPSIZE_NONE && !priv->wrap)))) (priv->ellipsize == PANGO_ELLIPSIZE_NONE && !priv->wrap))))
{ {
width = pixels_to_pango (allocation_width); width = (int) pixels_to_pango (allocation_width);
} }
/* Pango only uses height if ellipsization is enabled, so don't set /* Pango only uses height if ellipsization is enabled, so don't set
@ -980,7 +980,7 @@ clutter_text_create_layout (ClutterText *text,
priv->ellipsize != PANGO_ELLIPSIZE_NONE && priv->ellipsize != PANGO_ELLIPSIZE_NONE &&
!priv->single_line_mode) !priv->single_line_mode)
{ {
height = pixels_to_pango (allocation_height); height = (int) pixels_to_pango (allocation_height);
} }
/* Search for a cached layout with the same width and keep /* Search for a cached layout with the same width and keep
@ -1136,8 +1136,8 @@ clutter_text_coords_to_position (ClutterText *self,
/* Take any offset due to scrolling into account, and normalize /* Take any offset due to scrolling into account, and normalize
* the coordinates to PangoScale units * the coordinates to PangoScale units
*/ */
px = logical_pixels_to_pango (x - priv->text_logical_x, resource_scale); px = (int) logical_pixels_to_pango (x - priv->text_logical_x, resource_scale);
py = logical_pixels_to_pango (y - priv->text_logical_y, resource_scale); py = (int) logical_pixels_to_pango (y - priv->text_logical_y, resource_scale);
pango_layout_xy_to_index (clutter_text_get_layout (self), pango_layout_xy_to_index (clutter_text_get_layout (self),
px, py, px, py,
@ -1925,10 +1925,10 @@ paint_selection_rectangle (ClutterText *self,
color = &priv->text_color; color = &priv->text_color;
cogl_color_init_from_4f (&cogl_color, cogl_color_init_from_4f (&cogl_color,
color->red / 255.0, color->red / 255.0f,
color->green / 255.0, color->green / 255.0f,
color->blue / 255.0, color->blue / 255.0f,
paint_opacity / 255.0 * color->alpha / 255.0); paint_opacity / 255.0f * color->alpha / 255.0f);
cogl_color_premultiply (&cogl_color); cogl_color_premultiply (&cogl_color);
cogl_pipeline_set_color (color_pipeline, &cogl_color); cogl_pipeline_set_color (color_pipeline, &cogl_color);
@ -1945,10 +1945,10 @@ paint_selection_rectangle (ClutterText *self,
color = &priv->text_color; color = &priv->text_color;
cogl_color_init_from_4f (&cogl_color, cogl_color_init_from_4f (&cogl_color,
color->red / 255.0, color->red / 255.0f,
color->green / 255.0, color->green / 255.0f,
color->blue / 255.0, color->blue / 255.0f,
paint_opacity / 255.0 * color->alpha / 255.0); paint_opacity / 255.0f * color->alpha / 255.0f);
cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color); cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color);
@ -1982,10 +1982,10 @@ selection_paint (ClutterText *self,
cogl_color_init_from_4f (&cogl_color, cogl_color_init_from_4f (&cogl_color,
color->red / 255.0, color->red / 255.0f,
color->green / 255.0, color->green / 255.0f,
color->blue / 255.0, color->blue / 255.0f,
paint_opacity / 255.0 * color->alpha / 255.0); paint_opacity / 255.0f * color->alpha / 255.0f);
cogl_color_premultiply (&cogl_color); cogl_color_premultiply (&cogl_color);
cogl_pipeline_set_color (color_pipeline, &cogl_color); cogl_pipeline_set_color (color_pipeline, &cogl_color);
@ -2580,10 +2580,10 @@ clutter_text_compute_layout_offsets (ClutterText *self,
} }
if (text_x != NULL) if (text_x != NULL)
*text_x = floorf (x); *text_x = (int) floorf (x);
if (text_y != NULL) if (text_y != NULL)
*text_y = floorf (y); *text_y = (int) floorf (y);
} }
#define TEXT_PADDING 2 #define TEXT_PADDING 2
@ -2681,14 +2681,14 @@ clutter_text_paint (ClutterActor *self,
cogl_framebuffer_push_rectangle_clip (fb, 0, 0, alloc_width, alloc_height); cogl_framebuffer_push_rectangle_clip (fb, 0, 0, alloc_width, alloc_height);
clip_set = TRUE; clip_set = TRUE;
actor_width = alloc_width - 2 * TEXT_PADDING; actor_width = (int) (alloc_width - 2 * TEXT_PADDING);
text_width = pango_to_pixels (logical_rect.width); text_width = (int) pango_to_pixels (logical_rect.width);
rtl = priv->resolved_direction == CLUTTER_TEXT_DIRECTION_RTL; rtl = priv->resolved_direction == CLUTTER_TEXT_DIRECTION_RTL;
if (actor_width < text_width) if (actor_width < text_width)
{ {
gint cursor_x = graphene_rect_get_x (&priv->cursor_rect); gint cursor_x = (int) graphene_rect_get_x (&priv->cursor_rect);
if (priv->position == -1) if (priv->position == -1)
{ {
@ -2739,8 +2739,8 @@ clutter_text_paint (ClutterActor *self,
{ {
priv->text_x = text_x; priv->text_x = text_x;
priv->text_y = text_y; priv->text_y = text_y;
priv->text_logical_x = roundf ((float) text_x / resource_scale); priv->text_logical_x = (int) roundf ((float) text_x / resource_scale);
priv->text_logical_y = roundf ((float) text_y / resource_scale); priv->text_logical_y = (int) roundf ((float) text_y / resource_scale);
clutter_text_ensure_cursor_position (text, resource_scale); clutter_text_ensure_cursor_position (text, resource_scale);
} }
@ -2753,10 +2753,10 @@ clutter_text_paint (ClutterActor *self,
clutter_text_buffer_get_text (get_buffer (text))); clutter_text_buffer_get_text (get_buffer (text)));
cogl_color_init_from_4f (&color, cogl_color_init_from_4f (&color,
priv->text_color.red / 255.0, priv->text_color.red / 255.0f,
priv->text_color.green / 255.0, priv->text_color.green / 255.0f,
priv->text_color.blue / 255.0, priv->text_color.blue / 255.0f,
real_opacity / 255.0); real_opacity / 255.0f);
cogl_pango_show_layout (fb, layout, priv->text_x, priv->text_y, &color); cogl_pango_show_layout (fb, layout, priv->text_x, priv->text_y, &color);
selection_paint (text, fb); selection_paint (text, fb);

View file

@ -23,7 +23,7 @@
/** /**
* ClutterTimeline: * ClutterTimeline:
* *
* A class for time-based events * A class for time-based events
* *
* #ClutterTimeline is a base class for managing time-based event that cause * #ClutterTimeline is a base class for managing time-based event that cause
@ -270,7 +270,7 @@ clutter_timeline_add_marker_internal (ClutterTimeline *timeline,
guint msecs; guint msecs;
if (old_marker->is_relative) if (old_marker->is_relative)
msecs = old_marker->data.progress * priv->duration; msecs = (unsigned int) (old_marker->data.progress * priv->duration);
else else
msecs = old_marker->data.msecs; msecs = old_marker->data.msecs;
@ -836,9 +836,9 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
* *
* The signal is emitted each time a timeline * The signal is emitted each time a timeline
* reaches a marker set with [method@Timeline.add_marker_at_time]. * reaches a marker set with [method@Timeline.add_marker_at_time].
* *
* This signal is detailed with the name of the marker as well, * This signal is detailed with the name of the marker as well,
* so it is possible to connect a callback to the [signal@Timeline::marker-reached] * so it is possible to connect a callback to the [signal@Timeline::marker-reached]
* signal for a specific marker with: * signal for a specific marker with:
* *
* ```c * ```c
@ -966,7 +966,7 @@ check_if_marker_hit (const gchar *name,
gint msecs; gint msecs;
if (marker->is_relative) if (marker->is_relative)
msecs = (gdouble) data->duration * marker->data.progress; msecs = (int) ((double) data->duration * marker->data.progress);
else else
msecs = marker->data.msecs; msecs = marker->data.msecs;
@ -1875,7 +1875,7 @@ collect_markers (const gchar *key,
guint msecs; guint msecs;
if (marker->is_relative) if (marker->is_relative)
msecs = marker->data.progress * data->duration; msecs = (unsigned int) (marker->data.progress * data->duration);
else else
msecs = marker->data.msecs; msecs = marker->data.msecs;
@ -1994,7 +1994,7 @@ clutter_timeline_advance_to_marker (ClutterTimeline *timeline,
} }
if (marker->is_relative) if (marker->is_relative)
msecs = marker->data.progress * priv->duration; msecs = (unsigned int) (marker->data.progress * priv->duration);
else else
msecs = marker->data.msecs; msecs = marker->data.msecs;

View file

@ -453,8 +453,8 @@ cogl_pango_show_layout_line (CoglFramebuffer *fb,
PangoContext *context; PangoContext *context;
CoglPangoRenderer *priv; CoglPangoRenderer *priv;
CoglPangoRendererCaches *caches; CoglPangoRendererCaches *caches;
int pango_x = x * PANGO_SCALE; int pango_x = (int) (x * PANGO_SCALE);
int pango_y = y * PANGO_SCALE; int pango_y = (int) (y * PANGO_SCALE);
context = pango_layout_get_context (line->layout); context = pango_layout_get_context (line->layout);
priv = cogl_pango_get_renderer_from_context (context); priv = cogl_pango_get_renderer_from_context (context);
@ -702,10 +702,10 @@ cogl_pango_renderer_set_color_for_part (PangoRenderer *renderer,
CoglColor color; CoglColor color;
cogl_color_init_from_4f (&color, cogl_color_init_from_4f (&color,
pango_color->red / 65535.0, pango_color->red / 65535.0f,
pango_color->green / 65535.0, pango_color->green / 65535.0f,
pango_color->blue / 65535.0, pango_color->blue / 65535.0f,
alpha ? alpha / 65535.0 : 1.0); alpha ? alpha / 65535.0f : 1.0f);
_cogl_pango_display_list_set_color_override (priv->display_list, &color); _cogl_pango_display_list_set_color_override (priv->display_list, &color);
} }
@ -743,10 +743,10 @@ cogl_pango_renderer_get_device_units (PangoRenderer *renderer,
if ((matrix = pango_renderer_get_matrix (renderer))) if ((matrix = pango_renderer_get_matrix (renderer)))
{ {
/* Convert user-space coords to device coords */ /* Convert user-space coords to device coords */
*xout = ((xin * matrix->xx + yin * matrix->xy) *xout = (float) ((xin * matrix->xx + yin * matrix->xy) /
/ PANGO_SCALE + matrix->x0); PANGO_SCALE + matrix->x0);
*yout = ((yin * matrix->yy + xin * matrix->yx) *yout = (float) ((yin * matrix->yy + xin * matrix->yx) /
/ PANGO_SCALE + matrix->y0); PANGO_SCALE + matrix->y0);
} }
else else
{ {
@ -798,12 +798,12 @@ cogl_pango_renderer_draw_trapezoid (PangoRenderer *renderer,
cogl_pango_renderer_set_color_for_part (renderer, part); cogl_pango_renderer_set_color_for_part (renderer, part);
_cogl_pango_display_list_add_trapezoid (priv->display_list, _cogl_pango_display_list_add_trapezoid (priv->display_list,
y1, (float) y1,
x11, (float) x11,
x21, (float) x21,
y2, (float) y2,
x12, (float) x12,
x22); (float) x22);
} }
static void static void
@ -834,8 +834,8 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
if (font == NULL) if (font == NULL)
{ {
cogl_pango_renderer_draw_box (renderer, cogl_pango_renderer_draw_box (renderer,
x, (int) x,
y, (int) y,
PANGO_UNKNOWN_GLYPH_WIDTH, PANGO_UNKNOWN_GLYPH_WIDTH,
PANGO_UNKNOWN_GLYPH_HEIGHT); PANGO_UNKNOWN_GLYPH_HEIGHT);
} }
@ -847,8 +847,8 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
pango_extents_to_pixels (&ink_rect, NULL); pango_extents_to_pixels (&ink_rect, NULL);
cogl_pango_renderer_draw_box (renderer, cogl_pango_renderer_draw_box (renderer,
x + ink_rect.x, (int) (x + ink_rect.x),
y + ink_rect.y + ink_rect.height, (int) (y + ink_rect.y + ink_rect.height),
ink_rect.width, ink_rect.width,
ink_rect.height); ink_rect.height);
} }
@ -870,8 +870,8 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
if (cache_value == NULL) if (cache_value == NULL)
{ {
cogl_pango_renderer_draw_box (renderer, cogl_pango_renderer_draw_box (renderer,
x, (int) x,
y, (int) y,
PANGO_UNKNOWN_GLYPH_WIDTH, PANGO_UNKNOWN_GLYPH_WIDTH,
PANGO_UNKNOWN_GLYPH_HEIGHT); PANGO_UNKNOWN_GLYPH_HEIGHT);
} }
@ -888,8 +888,8 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
alpha = pango_renderer_get_alpha (renderer, alpha = pango_renderer_get_alpha (renderer,
PANGO_RENDER_PART_FOREGROUND); PANGO_RENDER_PART_FOREGROUND);
cogl_color_init_from_4f (&color, 1.0, 1.0, 1.0, cogl_color_init_from_4f (&color, 1.0f, 1.0f, 1.0f,
alpha ? (alpha >> 8) / 255.0 : 1.0); alpha ? (alpha >> 8) / 255.0f : 1.0f);
_cogl_pango_display_list_set_color_override (priv->display_list, &color); _cogl_pango_display_list_set_color_override (priv->display_list, &color);
} }

View file

@ -163,7 +163,7 @@ unpack_flt (uint32_t b)
#define PACK_10(b) ((uint32_t) ((b) * 1023.5f)) #define PACK_10(b) ((uint32_t) ((b) * 1023.5f))
#define PACK_16(b) ((uint32_t) ((b) * 65535.0f)) #define PACK_16(b) ((uint32_t) ((b) * 65535.0f))
#define PACK_SHORT(b) cogl_float_to_half (b) #define PACK_SHORT(b) cogl_float_to_half (b)
#define PACK_FLOAT(b) pack_flt((b) / 1.0) #define PACK_FLOAT(b) pack_flt((b) / 1.0f)
#define component_type float #define component_type float
#define component_size float #define component_size float

View file

@ -420,10 +420,10 @@ G_PASTE (_cogl_unpack_rgbx_fp_16161616_, component_size) (const uint8_t *src,
{ {
const uint16_t *src16 = (const uint16_t *) src; const uint16_t *src16 = (const uint16_t *) src;
dst[0] = UNPACK_SHORT (src16[0]); dst[0] = (component_type) UNPACK_SHORT (src16[0]);
dst[1] = UNPACK_SHORT (src16[1]); dst[1] = (component_type) UNPACK_SHORT (src16[1]);
dst[2] = UNPACK_SHORT (src16[2]); dst[2] = (component_type) UNPACK_SHORT (src16[2]);
dst[3] = UNPACK_SHORT (0x3C00); dst[3] = (component_type) UNPACK_SHORT (0x3C00);
dst += 4; dst += 4;
src += 8; src += 8;
} }
@ -438,10 +438,10 @@ G_PASTE (_cogl_unpack_rgba_fp_16161616_, component_size) (const uint8_t *src,
{ {
const uint16_t *src16 = (const uint16_t *) src; const uint16_t *src16 = (const uint16_t *) src;
dst[0] = UNPACK_SHORT (src16[0]); dst[0] = (component_type) UNPACK_SHORT (src16[0]);
dst[1] = UNPACK_SHORT (src16[1]); dst[1] = (component_type) UNPACK_SHORT (src16[1]);
dst[2] = UNPACK_SHORT (src16[2]); dst[2] = (component_type) UNPACK_SHORT (src16[2]);
dst[3] = UNPACK_SHORT (src16[3]); dst[3] = (component_type) UNPACK_SHORT (src16[3]);
dst += 4; dst += 4;
src += 8; src += 8;
} }
@ -456,10 +456,10 @@ G_PASTE (_cogl_unpack_bgrx_fp_16161616_, component_size) (const uint8_t *src,
{ {
const uint16_t *src16 = (const uint16_t *) src; const uint16_t *src16 = (const uint16_t *) src;
dst[0] = UNPACK_SHORT (src16[2]); dst[0] = (component_type) UNPACK_SHORT (src16[2]);
dst[1] = UNPACK_SHORT (src16[1]); dst[1] = (component_type) UNPACK_SHORT (src16[1]);
dst[2] = UNPACK_SHORT (src16[0]); dst[2] = (component_type) UNPACK_SHORT (src16[0]);
dst[3] = UNPACK_SHORT (0x3C00); dst[3] = (component_type) UNPACK_SHORT (0x3C00);
dst += 4; dst += 4;
src += 8; src += 8;
} }
@ -474,10 +474,10 @@ G_PASTE (_cogl_unpack_bgra_fp_16161616_, component_size) (const uint8_t *src,
{ {
const uint16_t *src16 = (const uint16_t *) src; const uint16_t *src16 = (const uint16_t *) src;
dst[0] = UNPACK_SHORT (src16[2]); dst[0] = (component_type) UNPACK_SHORT (src16[2]);
dst[1] = UNPACK_SHORT (src16[1]); dst[1] = (component_type) UNPACK_SHORT (src16[1]);
dst[2] = UNPACK_SHORT (src16[0]); dst[2] = (component_type) UNPACK_SHORT (src16[0]);
dst[3] = UNPACK_SHORT (src16[3]); dst[3] = (component_type) UNPACK_SHORT (src16[3]);
dst += 4; dst += 4;
src += 8; src += 8;
} }
@ -492,10 +492,10 @@ G_PASTE (_cogl_unpack_xrgb_fp_16161616_, component_size) (const uint8_t *src,
{ {
const uint16_t *src16 = (const uint16_t *) src; const uint16_t *src16 = (const uint16_t *) src;
dst[0] = UNPACK_SHORT (src16[1]); dst[0] = (component_type) UNPACK_SHORT (src16[1]);
dst[1] = UNPACK_SHORT (src16[2]); dst[1] = (component_type) UNPACK_SHORT (src16[2]);
dst[2] = UNPACK_SHORT (src16[3]); dst[2] = (component_type) UNPACK_SHORT (src16[3]);
dst[3] = UNPACK_SHORT (0x3C00); dst[3] = (component_type) UNPACK_SHORT (0x3C00);
dst += 4; dst += 4;
src += 8; src += 8;
} }
@ -510,10 +510,10 @@ G_PASTE (_cogl_unpack_argb_fp_16161616_, component_size) (const uint8_t *src,
{ {
const uint16_t *src16 = (const uint16_t *) src; const uint16_t *src16 = (const uint16_t *) src;
dst[0] = UNPACK_SHORT (src16[1]); dst[0] = (component_type) UNPACK_SHORT (src16[1]);
dst[1] = UNPACK_SHORT (src16[2]); dst[1] = (component_type) UNPACK_SHORT (src16[2]);
dst[2] = UNPACK_SHORT (src16[3]); dst[2] = (component_type) UNPACK_SHORT (src16[3]);
dst[3] = UNPACK_SHORT (src16[0]); dst[3] = (component_type) UNPACK_SHORT (src16[0]);
dst += 4; dst += 4;
src += 8; src += 8;
} }
@ -528,10 +528,10 @@ G_PASTE (_cogl_unpack_xbgr_fp_16161616_, component_size) (const uint8_t *src,
{ {
const uint16_t *src16 = (const uint16_t *) src; const uint16_t *src16 = (const uint16_t *) src;
dst[0] = UNPACK_SHORT (src16[3]); dst[0] = (component_type) UNPACK_SHORT (src16[3]);
dst[1] = UNPACK_SHORT (src16[2]); dst[1] = (component_type) UNPACK_SHORT (src16[2]);
dst[2] = UNPACK_SHORT (src16[1]); dst[2] = (component_type) UNPACK_SHORT (src16[1]);
dst[3] = UNPACK_SHORT (0x3C00); dst[3] = (component_type) UNPACK_SHORT (0x3C00);
dst += 4; dst += 4;
src += 8; src += 8;
} }
@ -546,10 +546,10 @@ G_PASTE (_cogl_unpack_abgr_fp_16161616_, component_size) (const uint8_t *src,
{ {
const uint16_t *src16 = (const uint16_t *) src; const uint16_t *src16 = (const uint16_t *) src;
dst[0] = UNPACK_SHORT (src16[3]); dst[0] = (component_type) UNPACK_SHORT (src16[3]);
dst[1] = UNPACK_SHORT (src16[2]); dst[1] = (component_type) UNPACK_SHORT (src16[2]);
dst[2] = UNPACK_SHORT (src16[1]); dst[2] = (component_type) UNPACK_SHORT (src16[1]);
dst[3] = UNPACK_SHORT (src16[0]); dst[3] = (component_type) UNPACK_SHORT (src16[0]);
dst += 4; dst += 4;
src += 8; src += 8;
} }
@ -564,10 +564,10 @@ G_PASTE (_cogl_unpack_rgba_fp_32323232_, component_size) (const uint8_t *src,
{ {
const uint32_t *src32 = (const uint32_t *) src; const uint32_t *src32 = (const uint32_t *) src;
dst[0] = UNPACK_FLOAT (src32[0]); dst[0] = (component_type) UNPACK_FLOAT (src32[0]);
dst[1] = UNPACK_FLOAT (src32[1]); dst[1] = (component_type) UNPACK_FLOAT (src32[1]);
dst[2] = UNPACK_FLOAT (src32[2]); dst[2] = (component_type) UNPACK_FLOAT (src32[2]);
dst[3] = UNPACK_FLOAT (src32[3]); dst[3] = (component_type) UNPACK_FLOAT (src32[3]);
dst += 4; dst += 4;
src += 16; src += 16;
} }

View file

@ -122,10 +122,10 @@ _cogl_clip_stack_entry_set_bounds (CoglClipStack *entry,
min_y = v[1]; min_y = v[1];
} }
entry->bounds_x0 = floorf (min_x); entry->bounds_x0 = (int) floorf (min_x);
entry->bounds_x1 = ceilf (max_x); entry->bounds_x1 = (int) ceilf (max_x);
entry->bounds_y0 = floorf (min_y); entry->bounds_y0 = (int) floorf (min_y);
entry->bounds_y1 = ceilf (max_y); entry->bounds_y1 = (int) ceilf (max_y);
} }
CoglClipStack * CoglClipStack *

View file

@ -76,10 +76,10 @@ cogl_color_init_from_4f (CoglColor *color,
{ {
g_return_if_fail (color != NULL); g_return_if_fail (color != NULL);
color->red = (red * 255); color->red = (int) (red * 255);
color->green = (green * 255); color->green = (int) (green * 255);
color->blue = (blue * 255); color->blue = (int) (blue * 255);
color->alpha = (alpha * 255); color->alpha = (int) (alpha * 255);
} }
static inline void static inline void
@ -109,10 +109,10 @@ parse_rgb_value (gchar *str,
{ {
*endp = (gchar *) (p + 1); *endp = (gchar *) (p + 1);
*color = CLAMP (number / 100.0, 0.0, 1.0) * 255; *color = (uint8_t) (CLAMP (number / 100.0, 0.0, 1.0) * 255);
} }
else else
*color = CLAMP (number, 0, 255); *color = (uint8_t) CLAMP (number, 0, 255);
} }
static gboolean static gboolean
@ -163,7 +163,7 @@ parse_rgba (CoglColor *color,
skip_whitespace (&str); skip_whitespace (&str);
number = g_ascii_strtod (str, &str); number = g_ascii_strtod (str, &str);
color->alpha = CLAMP (number * 255.0, 0, 255); color->alpha = (uint8_t) CLAMP (number * 255.0, 0, 255);
} }
else else
color->alpha = 255; color->alpha = 255;
@ -255,8 +255,8 @@ parse_hsla (CoglColor *color,
if (*str != ')') if (*str != ')')
return FALSE; return FALSE;
cogl_color_init_from_hsl (color, h, s, l); cogl_color_init_from_hsl (color, (float) h, (float) s, (float) l);
color->alpha = alpha; color->alpha = (uint8_t) alpha;
return TRUE; return TRUE;
} }
@ -376,25 +376,25 @@ cogl_color_to_string (const CoglColor *color)
float float
cogl_color_get_red (const CoglColor *color) cogl_color_get_red (const CoglColor *color)
{ {
return ((float) color->red / 255.0); return ((float) color->red / 255.0f);
} }
float float
cogl_color_get_green (const CoglColor *color) cogl_color_get_green (const CoglColor *color)
{ {
return ((float) color->green / 255.0); return ((float) color->green / 255.0f);
} }
float float
cogl_color_get_blue (const CoglColor *color) cogl_color_get_blue (const CoglColor *color)
{ {
return ((float) color->blue / 255.0); return ((float) color->blue / 255.0f);
} }
float float
cogl_color_get_alpha (const CoglColor *color) cogl_color_get_alpha (const CoglColor *color)
{ {
return ((float) color->alpha / 255.0); return ((float) color->alpha / 255.0f);
} }
void void
@ -440,9 +440,9 @@ cogl_color_to_hsl (const CoglColor *color,
float min, max, delta; float min, max, delta;
float h, l, s; float h, l, s;
red = color->red / 255.0; red = color->red / 255.0f;
green = color->green / 255.0; green = color->green / 255.0f;
blue = color->blue / 255.0; blue = color->blue / 255.0f;
if (red > green) if (red > green)
{ {
@ -478,21 +478,21 @@ cogl_color_to_hsl (const CoglColor *color,
if (l <= 0.5) if (l <= 0.5)
s = (max - min) / (max + min); s = (max - min) / (max + min);
else else
s = (max - min) / (2.0 - max - min); s = (max - min) / (2.0f - max - min);
delta = max - min; delta = max - min;
if (red == max) if (red == max)
h = (green - blue) / delta; h = (green - blue) / delta;
else if (green == max) else if (green == max)
h = 2.0 + (blue - red) / delta; h = 2.0f + (blue - red) / delta;
else if (blue == max) else if (blue == max)
h = 4.0 + (red - green) / delta; h = 4.0f + (red - green) / delta;
h *= 60; h *= 60;
if (h < 0) if (h < 0)
h += 360.0; h += 360.0f;
} }
if (hue) if (hue)
@ -516,7 +516,7 @@ cogl_color_init_from_hsl (CoglColor *color,
float clr[3]; float clr[3];
int i; int i;
hue /= 360.0; hue /= 360.0f;
if (saturation == 0) if (saturation == 0)
{ {
@ -524,31 +524,31 @@ cogl_color_init_from_hsl (CoglColor *color,
return; return;
} }
if (luminance <= 0.5) if (luminance <= 0.5f)
tmp2 = luminance * (1.0 + saturation); tmp2 = luminance * (1.0f + saturation);
else else
tmp2 = luminance + saturation - (luminance * saturation); tmp2 = luminance + saturation - (luminance * saturation);
tmp1 = 2.0 * luminance - tmp2; tmp1 = 2.0f * luminance - tmp2;
tmp3[0] = hue + 1.0 / 3.0; tmp3[0] = hue + 1.0f / 3.0f;
tmp3[1] = hue; tmp3[1] = hue;
tmp3[2] = hue - 1.0 / 3.0; tmp3[2] = hue - 1.0f / 3.0f;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
if (tmp3[i] < 0) if (tmp3[i] < 0)
tmp3[i] += 1.0; tmp3[i] += 1.0f;
if (tmp3[i] > 1) if (tmp3[i] > 1)
tmp3[i] -= 1.0; tmp3[i] -= 1.0f;
if (6.0 * tmp3[i] < 1.0) if (6.0f * tmp3[i] < 1.0f)
clr[i] = tmp1 + (tmp2 - tmp1) * tmp3[i] * 6.0; clr[i] = tmp1 + (tmp2 - tmp1) * tmp3[i] * 6.0f;
else if (2.0 * tmp3[i] < 1.0) else if (2.0f * tmp3[i] < 1.0f)
clr[i] = tmp2; clr[i] = tmp2;
else if (3.0 * tmp3[i] < 2.0) else if (3.0f * tmp3[i] < 2.0f)
clr[i] = (tmp1 + (tmp2 - tmp1) * ((2.0 / 3.0) - tmp3[i]) * 6.0); clr[i] = (tmp1 + (tmp2 - tmp1) * ((2.0f / 3.0f) - tmp3[i]) * 6.0f);
else else
clr[i] = tmp1; clr[i] = tmp1;
} }

View file

@ -1290,10 +1290,10 @@ _cogl_framebuffer_try_fast_read_pixel (CoglFramebuffer *framebuffer,
return FALSE; return FALSE;
} }
pixel[0] = priv->clear_color_red * 255.0; pixel[0] = (uint8_t) (priv->clear_color_red * 255.0f);
pixel[1] = priv->clear_color_green * 255.0; pixel[1] = (uint8_t) (priv->clear_color_green * 255.0f);
pixel[2] = priv->clear_color_blue * 255.0; pixel[2] = (uint8_t) (priv->clear_color_blue * 255.0f);
pixel[3] = priv->clear_color_alpha * 255.0; pixel[3] = (uint8_t) (priv->clear_color_alpha * 255.0f);
_cogl_bitmap_unmap (bitmap); _cogl_bitmap_unmap (bitmap);
@ -1669,7 +1669,7 @@ cogl_framebuffer_perspective (CoglFramebuffer *framebuffer,
{ {
CoglFramebufferPrivate *priv = CoglFramebufferPrivate *priv =
cogl_framebuffer_get_instance_private (framebuffer); cogl_framebuffer_get_instance_private (framebuffer);
float ymax = z_near * tanf (fov_y * G_PI / 360.0); float ymax = z_near * tanf (fov_y * (float) G_PI / 360.0f);
cogl_framebuffer_frustum (framebuffer, cogl_framebuffer_frustum (framebuffer,
-ymax * aspect, /* left */ -ymax * aspect, /* left */

View file

@ -357,15 +357,15 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
in the order 0xff, 0xcc, 0x99, and 0x66. This gives a total in the order 0xff, 0xcc, 0x99, and 0x66. This gives a total
of 24 colours. If there are more than 24 batches on the stage of 24 colours. If there are more than 24 batches on the stage
then it will wrap around */ then it will wrap around */
color_intensity = (0xff - 0x33 * (ctx->journal_rectangles_color >> 3) ) / 255.0; color_intensity = (0xff - 0x33 * (ctx->journal_rectangles_color >> 3) ) / 255.0f;
cogl_color_init_from_4f (&color, cogl_color_init_from_4f (&color,
(ctx->journal_rectangles_color & 1) ? (ctx->journal_rectangles_color & 1) ?
color_intensity : 0.0, color_intensity : 0.0f,
(ctx->journal_rectangles_color & 2) ? (ctx->journal_rectangles_color & 2) ?
color_intensity : 0.0, color_intensity : 0.0f,
(ctx->journal_rectangles_color & 4) ? (ctx->journal_rectangles_color & 4) ?
color_intensity : 0.0, color_intensity : 0.0f,
1.0); 1.0f);
cogl_pipeline_set_color (outline, &color); cogl_pipeline_set_color (outline, &color);
loop_attributes[0] = attributes[0]; /* we just want the position */ loop_attributes[0] = attributes[0]; /* we just want the position */
@ -1703,11 +1703,11 @@ entry_to_screen_polygon (CoglFramebuffer *framebuffer,
* to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with * to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with
* (0,0) being top left. */ * (0,0) being top left. */
#define VIEWPORT_TRANSFORM_X(x, vp_origin_x, vp_width) \ #define VIEWPORT_TRANSFORM_X(x, vp_origin_x, vp_width) \
( ( ((x) + 1.0) * ((vp_width) / 2.0) ) + (vp_origin_x) ) ( ( ((x) + 1.0f) * ((vp_width) / 2.0f) ) + (vp_origin_x) )
/* Note: for Y we first flip all coordinates around the X axis while in /* Note: for Y we first flip all coordinates around the X axis while in
* normalized device coordinates */ * normalized device coordinates */
#define VIEWPORT_TRANSFORM_Y(y, vp_origin_y, vp_height) \ #define VIEWPORT_TRANSFORM_Y(y, vp_origin_y, vp_height) \
( ( ((-(y)) + 1.0) * ((vp_height) / 2.0) ) + (vp_origin_y) ) ( ( ((-(y)) + 1.0f) * ((vp_height) / 2.0f) ) + (vp_origin_y) )
/* Scale from normalized device coordinates (in range [-1,1]) to /* Scale from normalized device coordinates (in range [-1,1]) to
* window coordinates ranging [0,window-size] ... */ * window coordinates ranging [0,window-size] ... */

View file

@ -193,10 +193,10 @@ create_grid_and_repeat_cb (CoglTexture *slice_texture,
* coordinates, and we will need to map the range [0,1] to the real * coordinates, and we will need to map the range [0,1] to the real
* slice_texture_coords we have here... */ * slice_texture_coords we have here... */
data->grid_slice_texture_coords = slice_texture_coords; data->grid_slice_texture_coords = slice_texture_coords;
data->slice_range_s = fabs (data->grid_slice_texture_coords[2] - data->slice_range_s = fabsf (data->grid_slice_texture_coords[2] -
data->grid_slice_texture_coords[0]); data->grid_slice_texture_coords[0]);
data->slice_range_t = fabs (data->grid_slice_texture_coords[3] - data->slice_range_t = fabsf (data->grid_slice_texture_coords[3] -
data->grid_slice_texture_coords[1]); data->grid_slice_texture_coords[1]);
data->slice_offset_s = MIN (data->grid_slice_texture_coords[0], data->slice_offset_s = MIN (data->grid_slice_texture_coords[0],
data->grid_slice_texture_coords[2]); data->grid_slice_texture_coords[2]);
data->slice_offset_t = MIN (data->grid_slice_texture_coords[1], data->slice_offset_t = MIN (data->grid_slice_texture_coords[1],
@ -525,8 +525,8 @@ cogl_meta_texture_foreach_in_region (CoglTexture *texture,
data.callback = callback; data.callback = callback;
data.user_data = user_data; data.user_data = user_data;
data.width = width; data.width = (int) width;
data.height = height; data.height = (int) height;
memset (data.padded_textures, 0, sizeof (data.padded_textures)); memset (data.padded_textures, 0, sizeof (data.padded_textures));

View file

@ -246,16 +246,16 @@ _cogl_texture_quad_multiple_primitives (CoglFramebuffer *framebuffer,
/* We use the _len_AXIS naming here instead of _width and _height because /* We use the _len_AXIS naming here instead of _width and _height because
* log_quad_slice_cb uses a macro with symbol concatenation to handle both * log_quad_slice_cb uses a macro with symbol concatenation to handle both
* axis, so this is more convenient... */ * axis, so this is more convenient... */
state.quad_len_x = fabs (position[X1] - position[X0]); state.quad_len_x = fabsf (position[X1] - position[X0]);
state.quad_len_y = fabs (position[Y1] - position[Y0]); state.quad_len_y = fabsf (position[Y1] - position[Y0]);
#undef X0 #undef X0
#undef Y0 #undef Y0
#undef X1 #undef X1
#undef Y1 #undef Y1
state.v_to_q_scale_x = fabs (state.quad_len_x / (tx_2 - tx_1)); state.v_to_q_scale_x = fabsf (state.quad_len_x / (tx_2 - tx_1));
state.v_to_q_scale_y = fabs (state.quad_len_y / (ty_2 - ty_1)); state.v_to_q_scale_y = fabsf (state.quad_len_y / (ty_2 - ty_1));
/* For backwards compatibility the default wrap mode for cogl_rectangle() is /* For backwards compatibility the default wrap mode for cogl_rectangle() is
* _REPEAT... */ * _REPEAT... */

View file

@ -132,8 +132,8 @@ _cogl_rect_slices_for_size (int size_to_fill,
/* Add another slice span of same size */ /* Add another slice span of same size */
if (out_spans) if (out_spans)
g_array_append_val (out_spans, span); g_array_append_val (out_spans, span);
span.start += span.size; span.start += (int) span.size;
size_to_fill -= span.size; size_to_fill -= (int) span.size;
n_spans++; n_spans++;
} }
@ -322,7 +322,8 @@ allocate_slices (CoglTexture2DSliced *tex_2ds,
slice = slice =
cogl_texture_2d_new_with_size (ctx, cogl_texture_2d_new_with_size (ctx,
x_span->size, y_span->size); (int) x_span->size,
(int) y_span->size);
_cogl_texture_copy_internal_format (tex, slice); _cogl_texture_copy_internal_format (tex, slice);
@ -392,8 +393,8 @@ _cogl_texture_2d_sliced_allocate_waste_buffer (CoglTexture2DSliced *tex_2ds,
= &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0); = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
CoglSpan *first_y_span CoglSpan *first_y_span
= &g_array_index (tex_2ds->slice_y_spans, CoglSpan, 0); = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, 0);
unsigned int right_size = first_y_span->size * last_x_span->waste; unsigned int right_size = (unsigned int) (first_y_span->size * last_x_span->waste);
unsigned int bottom_size = first_x_span->size * last_y_span->waste; unsigned int bottom_size = (unsigned int) (first_x_span->size * last_y_span->waste);
waste_buf = g_malloc (MAX (right_size, bottom_size) * bpp); waste_buf = g_malloc (MAX (right_size, bottom_size) * bpp);
} }
@ -472,25 +473,25 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds,
} }
waste_bmp = cogl_bitmap_new_for_data (ctx, waste_bmp = cogl_bitmap_new_for_data (ctx,
x_span->waste, (int) x_span->waste,
y_iter->intersect_end - (int) (y_iter->intersect_end -
y_iter->intersect_start, y_iter->intersect_start),
source_format, source_format,
x_span->waste * bpp, (int) (x_span->waste * bpp),
waste_buf); waste_buf);
if (!_cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex), if (!_cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex),
0, /* src_x */ 0, /* src_x */
0, /* src_y */ 0, /* src_y */
x_span->waste, /* width */ (int) x_span->waste, /* width */
/* height */ /* height */
y_iter->intersect_end - (int) (y_iter->intersect_end -
y_iter->intersect_start, y_iter->intersect_start),
waste_bmp, waste_bmp,
/* dst_x */ /* dst_x */
x_span->size - x_span->waste, (int) (x_span->size - x_span->waste),
y_iter->intersect_start - (int) (y_iter->intersect_start -
y_span->start, /* dst_y */ y_span->start), /* dst_y */
0, /* level */ 0, /* level */
error)) error))
{ {
@ -515,11 +516,11 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds,
if (x_iter->intersect_end - x_iter->pos if (x_iter->intersect_end - x_iter->pos
>= x_span->size - x_span->waste) >= x_span->size - x_span->waste)
copy_width = x_span->size + x_iter->pos - x_iter->intersect_start; copy_width = (unsigned int) (x_span->size + x_iter->pos - x_iter->intersect_start);
else else
copy_width = x_iter->intersect_end - x_iter->intersect_start; copy_width = (unsigned int) (x_iter->intersect_end - x_iter->intersect_start);
intersect_width = x_iter->intersect_end - x_iter->intersect_start; intersect_width = (unsigned int) (x_iter->intersect_end - x_iter->intersect_start);
for (wy = 0; wy < y_span->waste; wy++) for (wy = 0; wy < y_span->waste; wy++)
{ {
@ -535,7 +536,7 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds,
waste_bmp = cogl_bitmap_new_for_data (ctx, waste_bmp = cogl_bitmap_new_for_data (ctx,
copy_width, copy_width,
y_span->waste, (int) y_span->waste,
source_format, source_format,
copy_width * bpp, copy_width * bpp,
waste_buf); waste_buf);
@ -544,13 +545,13 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds,
0, /* src_x */ 0, /* src_x */
0, /* src_y */ 0, /* src_y */
copy_width, /* width */ copy_width, /* width */
y_span->waste, /* height */ (int) y_span->waste, /* height */
waste_bmp, waste_bmp,
/* dst_x */ /* dst_x */
x_iter->intersect_start - (int) (x_iter->intersect_start -
x_iter->pos, x_iter->pos),
/* dst_y */ /* dst_y */
y_span->size - y_span->waste, (int) (y_span->size - y_span->waste),
0, /* level */ 0, /* level */
error)) error))
{ {
@ -603,12 +604,12 @@ _cogl_texture_2d_sliced_upload_bitmap (CoglTexture2DSliced *tex_2ds,
CoglTexture2D *, slice_num); CoglTexture2D *, slice_num);
if (!_cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex), if (!_cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex),
x_span->start, /* src x */ (int) x_span->start, /* src x */
y_span->start, /* src y */ (int) y_span->start, /* src y */
x_span->size - (int) (x_span->size -
x_span->waste, /* width */ x_span->waste), /* width */
y_span->size - (int) (y_span->size -
y_span->waste, /* height */ y_span->waste), /* height */
bmp, bmp,
0, /* dst x */ 0, /* dst x */
0, /* dst y */ 0, /* dst y */
@ -1012,12 +1013,12 @@ _cogl_texture_2d_sliced_upload_subregion (CoglTexture2DSliced *tex_2ds,
x_iter.index); x_iter.index);
/* Pick intersection width and height */ /* Pick intersection width and height */
inter_w = (x_iter.intersect_end - x_iter.intersect_start); inter_w = (int) (x_iter.intersect_end - x_iter.intersect_start);
inter_h = (y_iter.intersect_end - y_iter.intersect_start); inter_h = (int) (y_iter.intersect_end - y_iter.intersect_start);
/* Localize intersection top-left corner to slice*/ /* Localize intersection top-left corner to slice*/
local_x = (x_iter.intersect_start - x_iter.pos); local_x = (int) (x_iter.intersect_start - x_iter.pos);
local_y = (y_iter.intersect_start - y_iter.pos); local_y = (int) (y_iter.intersect_start - y_iter.pos);
slice_num = y_iter.index * tex_2ds->slice_x_spans->len + x_iter.index; slice_num = y_iter.index * tex_2ds->slice_x_spans->len + x_iter.index;

View file

@ -101,11 +101,11 @@ _cogl_driver_error_quark (void)
* to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with * to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with
* (0,0) being top left. */ * (0,0) being top left. */
#define VIEWPORT_TRANSFORM_X(x, vp_origin_x, vp_width) \ #define VIEWPORT_TRANSFORM_X(x, vp_origin_x, vp_width) \
( ( ((x) + 1.0) * ((vp_width) / 2.0) ) + (vp_origin_x) ) ( ( ((x) + 1.0f) * ((vp_width) / 2.0f) ) + (vp_origin_x) )
/* Note: for Y we first flip all coordinates around the X axis while in /* Note: for Y we first flip all coordinates around the X axis while in
* normalized device coordinates */ * normalized device coordinates */
#define VIEWPORT_TRANSFORM_Y(y, vp_origin_y, vp_height) \ #define VIEWPORT_TRANSFORM_Y(y, vp_origin_y, vp_height) \
( ( ((-(y)) + 1.0) * ((vp_height) / 2.0) ) + (vp_origin_y) ) ( ( ((-(y)) + 1.0f) * ((vp_height) / 2.0f) ) + (vp_origin_y) )
/* Transform a homogeneous vertex position from model space to Cogl /* Transform a homogeneous vertex position from model space to Cogl
* window coordinates (with 0,0 being top left) */ * window coordinates (with 0,0 being top left) */

View file

@ -153,9 +153,9 @@ add_stencil_clip_region (CoglFramebuffer *framebuffer,
graphene_matrix_init_translate (&matrix, &p); graphene_matrix_init_translate (&matrix, &p);
graphene_matrix_scale (&matrix, graphene_matrix_scale (&matrix,
2.0 / cogl_framebuffer_get_viewport_width (framebuffer), 2.0f / cogl_framebuffer_get_viewport_width (framebuffer),
- 2.0 / cogl_framebuffer_get_viewport_height (framebuffer), - 2.0f / cogl_framebuffer_get_viewport_height (framebuffer),
1); 1.0);
graphene_matrix_translate (&matrix, &GRAPHENE_POINT3D_INIT (-1.f, 1.f, 0.f)); graphene_matrix_translate (&matrix, &GRAPHENE_POINT3D_INIT (-1.f, 1.f, 0.f));
GE( ctx, glColorMask (FALSE, FALSE, FALSE, FALSE) ); GE( ctx, glColorMask (FALSE, FALSE, FALSE, FALSE) );

View file

@ -92,10 +92,10 @@ cogl_gl_framebuffer_flush_viewport_state (CoglGlFramebuffer *gl_framebuffer)
viewport_height); viewport_height);
GE (cogl_framebuffer_get_context (framebuffer), GE (cogl_framebuffer_get_context (framebuffer),
glViewport (viewport_x, glViewport ((GLint) viewport_x,
gl_viewport_y, (GLint) gl_viewport_y,
viewport_width, (GLsizei) viewport_width,
viewport_height)); (GLsizei) viewport_height));
} }
static void static void

View file

@ -516,6 +516,7 @@ if buildtype != 'plain'
'-Wno-missing-field-initializers', '-Wno-missing-field-initializers',
'-Wno-type-limits', '-Wno-type-limits',
'-Wshadow', '-Wshadow',
'-Wfloat-conversion',
] ]
if get_option('debug') if get_option('debug')

View file

@ -358,10 +358,10 @@ mtk_rectangle_from_graphene_rect (const graphene_rect_t *rect,
case MTK_ROUNDING_STRATEGY_SHRINK: case MTK_ROUNDING_STRATEGY_SHRINK:
{ {
*dest = (MtkRectangle) { *dest = (MtkRectangle) {
.x = ceilf (rect->origin.x), .x = (int) ceilf (rect->origin.x),
.y = ceilf (rect->origin.y), .y = (int) ceilf (rect->origin.y),
.width = floorf (rect->size.width), .width = (int) floorf (rect->size.width),
.height = floorf (rect->size.height), .height = (int) floorf (rect->size.height),
}; };
} }
break; break;
@ -372,20 +372,20 @@ mtk_rectangle_from_graphene_rect (const graphene_rect_t *rect,
graphene_rect_round_extents (&clamped, &clamped); graphene_rect_round_extents (&clamped, &clamped);
*dest = (MtkRectangle) { *dest = (MtkRectangle) {
.x = clamped.origin.x, .x = (int) clamped.origin.x,
.y = clamped.origin.y, .y = (int) clamped.origin.y,
.width = clamped.size.width, .width = (int) clamped.size.width,
.height = clamped.size.height, .height = (int) clamped.size.height,
}; };
} }
break; break;
case MTK_ROUNDING_STRATEGY_ROUND: case MTK_ROUNDING_STRATEGY_ROUND:
{ {
*dest = (MtkRectangle) { *dest = (MtkRectangle) {
.x = roundf (rect->origin.x), .x = (int) roundf (rect->origin.x),
.y = roundf (rect->origin.y), .y = (int) roundf (rect->origin.y),
.width = roundf (rect->size.width), .width = (int) roundf (rect->size.width),
.height = roundf (rect->size.height), .height = (int) roundf (rect->size.height),
}; };
} }
} }
@ -419,7 +419,7 @@ mtk_rectangle_scale_double (const MtkRectangle *rect,
graphene_rect_t tmp = GRAPHENE_RECT_INIT (rect->x, rect->y, graphene_rect_t tmp = GRAPHENE_RECT_INIT (rect->x, rect->y,
rect->width, rect->height); rect->width, rect->height);
graphene_rect_scale (&tmp, scale, scale, &tmp); graphene_rect_scale (&tmp, (float) scale, (float) scale, &tmp);
mtk_rectangle_from_graphene_rect (&tmp, rounding_strategy, dest); mtk_rectangle_from_graphene_rect (&tmp, rounding_strategy, dest);
} }

View file

@ -289,8 +289,8 @@ init_pointer_position (MetaBackend *backend)
/* Move the pointer out of the way to avoid hovering over reactive /* Move the pointer out of the way to avoid hovering over reactive
* elements (e.g. users list at login) causing undesired behaviour. */ * elements (e.g. users list at login) causing undesired behaviour. */
clutter_seat_init_pointer_position (seat, clutter_seat_init_pointer_position (seat,
primary->rect.x + primary->rect.width * 0.9, primary->rect.x + primary->rect.width * 0.9f,
primary->rect.y + primary->rect.height * 0.9); primary->rect.y + primary->rect.height * 0.9f);
cursor_renderer = meta_backend_get_cursor_renderer (backend); cursor_renderer = meta_backend_get_cursor_renderer (backend);
meta_cursor_renderer_update_position (cursor_renderer); meta_cursor_renderer_update_position (cursor_renderer);

View file

@ -94,16 +94,16 @@ meta_barrier_get_property (GObject *object,
g_value_set_object (value, priv->backend); g_value_set_object (value, priv->backend);
break; break;
case PROP_X1: case PROP_X1:
g_value_set_int (value, priv->border.line.a.x); g_value_set_int (value, (int) priv->border.line.a.x);
break; break;
case PROP_Y1: case PROP_Y1:
g_value_set_int (value, priv->border.line.a.y); g_value_set_int (value, (int) priv->border.line.a.y);
break; break;
case PROP_X2: case PROP_X2:
g_value_set_int (value, priv->border.line.b.x); g_value_set_int (value, (int) priv->border.line.b.x);
break; break;
case PROP_Y2: case PROP_Y2:
g_value_set_int (value, priv->border.line.b.y); g_value_set_int (value, (int) priv->border.line.b.y);
break; break;
case PROP_DIRECTIONS: case PROP_DIRECTIONS:
g_value_set_flags (value, g_value_set_flags (value,

View file

@ -451,16 +451,16 @@ generate_gamma_lut_from_vcgt (MetaColorProfile *color_profile,
{ {
cmsFloat32Number in; cmsFloat32Number in;
in = (double) i / (double) (lut_size - 1); in = (cmsFloat32Number) ((double) i / (double) (lut_size - 1));
lut->red[i] = lut->red[i] =
cmsEvalToneCurveFloat (vcgt[0], in) * (uint16_t) (cmsEvalToneCurveFloat (vcgt[0], in) *
blackbody_color.R * (double) 0xffff; blackbody_color.R * (double) 0xffff);
lut->green[i] = lut->green[i] =
cmsEvalToneCurveFloat (vcgt[1], in) * (uint16_t) (cmsEvalToneCurveFloat (vcgt[1], in) *
blackbody_color.G * (double) 0xffff; blackbody_color.G * (double) 0xffff);
lut->blue[i] = lut->blue[i] =
cmsEvalToneCurveFloat (vcgt[2], in) * (uint16_t) (cmsEvalToneCurveFloat (vcgt[2], in) *
blackbody_color.B * (gdouble) 0xffff; blackbody_color.B * (gdouble) 0xffff);
} }
return lut; return lut;
@ -492,9 +492,9 @@ generate_gamma_lut (MetaColorProfile *color_profile,
uint16_t in; uint16_t in;
in = (i * 0xffff) / (lut->size - 1); in = (i * 0xffff) / (lut->size - 1);
lut->red[i] = in * blackbody_color.R; lut->red[i] = (uint16_t) (in * blackbody_color.R);
lut->green[i] = in * blackbody_color.G; lut->green[i] = (uint16_t) (in * blackbody_color.G);
lut->blue[i] = in * blackbody_color.B; lut->blue[i] = (uint16_t) (in * blackbody_color.B);
} }
return lut; return lut;

View file

@ -236,9 +236,9 @@ meta_gamma_lut_new_identity (int size)
{ {
double value = (i / (double) (size - 1)); double value = (i / (double) (size - 1));
lut->red[i] = value * UINT16_MAX; lut->red[i] = (uint16_t) (value * UINT16_MAX);
lut->green[i] = value * UINT16_MAX; lut->green[i] = (uint16_t) (value * UINT16_MAX);
lut->blue[i] = value * UINT16_MAX; lut->blue[i] = (uint16_t) (value * UINT16_MAX);
} }
return lut; return lut;
@ -254,7 +254,7 @@ meta_gamma_lut_is_identity (const MetaGammaLut *lut)
for (i = 0; i < lut->size; i++) for (i = 0; i < lut->size; i++)
{ {
uint16_t value = (i / (double) (lut->size - 1)) * UINT16_MAX; uint16_t value = (uint16_t) ((i / (double) (lut->size - 1)) * UINT16_MAX);
if (ABS (lut->red[i] - value) > 1 || if (ABS (lut->red[i] - value) > 1 ||
ABS (lut->green[i] - value) > 1 || ABS (lut->green[i] - value) > 1 ||

View file

@ -1021,7 +1021,7 @@ handle_release (MetaDBusInputCaptureSession *object,
meta_input_capture_session_deactivate (session); meta_input_capture_session_deactivate (session);
if (g_variant_lookup (arg_options, "cursor_position", "(dd)", &x, &y)) if (g_variant_lookup (arg_options, "cursor_position", "(dd)", &x, &y))
clutter_seat_warp_pointer (seat, x, y); clutter_seat_warp_pointer (seat, (int) x, (int) y);
if (session->handle) if (session->handle)
release_remote_access_handle (session); release_remote_access_handle (session);

View file

@ -1851,10 +1851,10 @@ meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor
switch (layout_mode) switch (layout_mode)
{ {
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL: case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
expected_mode_width = roundf (expected_mode_width * expected_mode_width = (int) roundf (expected_mode_width *
logical_monitor_config->scale); logical_monitor_config->scale);
expected_mode_height = roundf (expected_mode_height * expected_mode_height = (int) roundf (expected_mode_height *
logical_monitor_config->scale); logical_monitor_config->scale);
break; break;
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL: case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
break; break;

View file

@ -463,7 +463,7 @@ read_float (const char *text,
strncpy (buf, text, text_len); strncpy (buf, text, text_len);
buf[MIN (63, text_len)] = 0; buf[MIN (63, text_len)] = 0;
v = g_ascii_strtod (buf, &end); v = (float) g_ascii_strtod (buf, &end);
/* Limit reasonable values (actual limits are a lot smaller that these) */ /* Limit reasonable values (actual limits are a lot smaller that these) */
if (*end) if (*end)

View file

@ -717,8 +717,8 @@ derive_logical_monitor_layout (MetaLogicalMonitorConfig *logical_monitor_conf
switch (layout_mode) switch (layout_mode)
{ {
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL: case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
width = roundf (width / scale); width = (int) roundf (width / scale);
height = roundf (height / scale); height = (int) roundf (height / scale);
break; break;
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL: case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
if (!G_APPROX_VALUE (scale, roundf (scale), FLT_EPSILON)) if (!G_APPROX_VALUE (scale, roundf (scale), FLT_EPSILON))
@ -1144,7 +1144,7 @@ read_float (const char *text,
strncpy (buf, text, text_len); strncpy (buf, text, text_len);
buf[MIN (63, text_len)] = 0; buf[MIN (63, text_len)] = 0;
value = g_ascii_strtod (buf, &end); value = (float) g_ascii_strtod (buf, &end);
if (*end) if (*end)
{ {

View file

@ -254,7 +254,7 @@ append_tiled_monitor (MetaMonitorManager *manager,
GList **modes, GList **modes,
GList **crtcs, GList **crtcs,
GList **outputs, GList **outputs,
int scale) float scale)
{ {
MetaGpu *gpu = get_gpu (manager); MetaGpu *gpu = get_gpu (manager);
CrtcModeSpec mode_specs[] = { CrtcModeSpec mode_specs[] = {
@ -451,7 +451,7 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
"of monitors (defaults to 1)."); "of monitors (defaults to 1).");
for (i = 0; i < num_monitors && scales_str_list[i]; i++) for (i = 0; i < num_monitors && scales_str_list[i]; i++)
{ {
float scale = g_ascii_strtod (scales_str_list[i], NULL); float scale = (float) g_ascii_strtod (scales_str_list[i], NULL);
monitor_scales[i] = scale; monitor_scales[i] = scale;
} }

View file

@ -2630,8 +2630,8 @@ derive_logical_monitor_size (MetaMonitorConfig *monitor_config,
switch (layout_mode) switch (layout_mode)
{ {
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL: case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
width = roundf (width / scale); width = (int) roundf (width / scale);
height = roundf (height / scale); height = (int) roundf (height / scale);
break; break;
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL: case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
break; break;
@ -3403,7 +3403,7 @@ meta_monitor_manager_get_logical_monitor_at (MetaMonitorManager *manager,
{ {
MetaLogicalMonitor *logical_monitor = l->data; MetaLogicalMonitor *logical_monitor = l->data;
if (mtk_rectangle_contains_point (&logical_monitor->rect, x, y)) if (mtk_rectangle_contains_pointf (&logical_monitor->rect, x, y))
return logical_monitor; return logical_monitor;
} }

View file

@ -30,11 +30,11 @@
#include "core/boxes-private.h" #include "core/boxes-private.h"
#define SCALE_FACTORS_PER_INTEGER 4 #define SCALE_FACTORS_PER_INTEGER 4
#define SCALE_FACTORS_STEPS (1.0 / (float) SCALE_FACTORS_PER_INTEGER) #define SCALE_FACTORS_STEPS (1.0f / (float) SCALE_FACTORS_PER_INTEGER)
#define MINIMUM_SCALE_FACTOR 1.0f #define MINIMUM_SCALE_FACTOR 1.0f
#define MAXIMUM_SCALE_FACTOR 4.0f #define MAXIMUM_SCALE_FACTOR 4.0f
#define MINIMUM_LOGICAL_AREA (800 * 480) #define MINIMUM_LOGICAL_AREA (800 * 480)
#define MAXIMUM_REFRESH_RATE_DIFF 0.001 #define MAXIMUM_REFRESH_RATE_DIFF 0.001f
typedef struct _MetaMonitorMode typedef struct _MetaMonitorMode
{ {
@ -1607,10 +1607,10 @@ meta_monitor_tiled_derive_layout (MetaMonitor *monitor,
} }
*layout = (MtkRectangle) { *layout = (MtkRectangle) {
.x = roundf (min_x), .x = (int) roundf (min_x),
.y = roundf (min_y), .y = (int) roundf (min_y),
.width = roundf (max_x - min_x), .width = (int) roundf (max_x - min_x),
.height = roundf (max_y - min_y) .height = (int) roundf (max_y - min_y)
}; };
} }
@ -1711,12 +1711,12 @@ gboolean
meta_monitor_mode_spec_has_similar_size (MetaMonitorModeSpec *monitor_mode_spec, meta_monitor_mode_spec_has_similar_size (MetaMonitorModeSpec *monitor_mode_spec,
MetaMonitorModeSpec *other_monitor_mode_spec) MetaMonitorModeSpec *other_monitor_mode_spec)
{ {
const float target_ratio = 1.0; const float target_ratio = 1.0f;
/* The a size difference of 15% means e.g. 4K modes matches other 4K modes, /* The a size difference of 15% means e.g. 4K modes matches other 4K modes,
* FHD (2K) modes other FHD modes, and HD modes other HD modes, but not each * FHD (2K) modes other FHD modes, and HD modes other HD modes, but not each
* other. * other.
*/ */
const float epsilon = 0.15; const float epsilon = 0.15f;
return G_APPROX_VALUE (((float) monitor_mode_spec->width / return G_APPROX_VALUE (((float) monitor_mode_spec->width /
other_monitor_mode_spec->width) * other_monitor_mode_spec->width) *
@ -1877,7 +1877,7 @@ calculate_scale (MetaMonitor *monitor,
int n_scales; int n_scales;
float best_scale, best_dpi; float best_scale, best_dpi;
int target_dpi; int target_dpi;
const float scale_epsilon = 0.2; const float scale_epsilon = 0.2f;
/* /*
* Somebody encoded the aspect ratio (16/9 or 16/10) instead of the physical * Somebody encoded the aspect ratio (16/9 or 16/10) instead of the physical
@ -1890,7 +1890,7 @@ calculate_scale (MetaMonitor *monitor,
meta_monitor_get_physical_dimensions (monitor, &width_mm, &height_mm); meta_monitor_get_physical_dimensions (monitor, &width_mm, &height_mm);
if (width_mm == 0 || height_mm == 0) if (width_mm == 0 || height_mm == 0)
return 1.0; return 1.0;
diag_inches = sqrtf (width_mm * width_mm + height_mm * height_mm) / 25.4; diag_inches = sqrtf (width_mm * width_mm + height_mm * height_mm) / 25.4f;
/* Pick the appropriate target DPI based on screen size */ /* Pick the appropriate target DPI based on screen size */
if (diag_inches < UI_SCALE_LARGE_MIN_SIZE_INCHES) if (diag_inches < UI_SCALE_LARGE_MIN_SIZE_INCHES)
@ -1937,7 +1937,7 @@ calculate_scale (MetaMonitor *monitor,
if (constraints & META_MONITOR_SCALES_CONSTRAINT_NO_FRAC) if (constraints & META_MONITOR_SCALES_CONSTRAINT_NO_FRAC)
{ {
best_scale = floorf (MIN (scales[n_scales - 1], best_scale = floorf (MIN (scales[n_scales - 1],
best_scale + 0.25 + scale_epsilon)); best_scale + 0.25f + scale_epsilon));
} }
return best_scale; return best_scale;
@ -1974,8 +1974,8 @@ is_scale_valid_for_size (float width,
if (scale < MINIMUM_SCALE_FACTOR || scale > MAXIMUM_SCALE_FACTOR) if (scale < MINIMUM_SCALE_FACTOR || scale > MAXIMUM_SCALE_FACTOR)
return FALSE; return FALSE;
return is_logical_size_large_enough (floorf (width / scale), return is_logical_size_large_enough ((int) floorf (width / scale),
floorf (height / scale)); (int) floorf (height / scale));
} }
gboolean gboolean
@ -2017,7 +2017,7 @@ get_closest_scale_factor_for_resolution (float width,
i = 0; i = 0;
found_one = FALSE; found_one = FALSE;
base_scaled_w = floorf (width / scale); base_scaled_w = (int) floorf (width / scale);
do do
{ {
@ -2371,8 +2371,8 @@ meta_parse_monitor_mode (const char *string,
return FALSE; return FALSE;
ptr++; ptr++;
refresh_rate = g_ascii_strtod (ptr, &ptr); refresh_rate = (float) g_ascii_strtod (ptr, &ptr);
if (refresh_rate == 0.0) if (G_APPROX_VALUE (refresh_rate, 0.0f, FLT_EPSILON))
return FALSE; return FALSE;
if (ptr[0] != '\0') if (ptr[0] != '\0')

View file

@ -16,6 +16,10 @@
* *
*/ */
/* Till https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4065 is fixed */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#include "config.h" #include "config.h"
#include "backends/meta-screen-cast-area-stream-src.h" #include "backends/meta-screen-cast-area-stream-src.h"
@ -750,3 +754,5 @@ meta_screen_cast_area_stream_src_class_init (MetaScreenCastAreaStreamSrcClass *k
src_class->set_cursor_metadata = src_class->set_cursor_metadata =
meta_screen_cast_area_stream_src_set_cursor_metadata; meta_screen_cast_area_stream_src_set_cursor_metadata;
} }
#pragma GCC diagnostic pop

View file

@ -172,8 +172,8 @@ transform_position (MetaScreenCastAreaStream *area_stream,
double *out_x, double *out_x,
double *out_y) double *out_y)
{ {
*out_x = area_stream->area.x + (int) roundf (x / area_stream->scale); *out_x = area_stream->area.x + (int) round (x / area_stream->scale);
*out_y = area_stream->area.y + (int) roundf (y / area_stream->scale); *out_y = area_stream->area.y + (int) round (y / area_stream->scale);
} }
static gboolean static gboolean

View file

@ -17,9 +17,12 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>. * along with this program; if not, see <http://www.gnu.org/licenses/>.
* *
*/ */
/* Till https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3915 is fixed */
#pragma GCC diagnostic push #pragma GCC diagnostic push
/* Till https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3915 is fixed */
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
/* Till https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4065 is fixed */
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#include "config.h" #include "config.h"
@ -394,8 +397,8 @@ meta_screen_cast_stream_src_draw_cursor_into (MetaScreenCastStreamSrc *src,
texture_width = cogl_texture_get_width (cursor_texture); texture_width = cogl_texture_get_width (cursor_texture);
texture_height = cogl_texture_get_height (cursor_texture); texture_height = cogl_texture_get_height (cursor_texture);
width = texture_width * scale; width = (int) ceilf (texture_width * scale);
height = texture_height * scale; height = (int) ceilf (texture_height * scale);
if (texture_width == width && if (texture_width == width &&
texture_height == height && texture_height == height &&
@ -512,8 +515,8 @@ meta_screen_cast_stream_src_set_cursor_sprite_metadata (MetaScreenCastStreamSrc
texture_width = cogl_texture_get_width (cursor_texture); texture_width = cogl_texture_get_width (cursor_texture);
texture_height = cogl_texture_get_height (cursor_texture); texture_height = cogl_texture_get_height (cursor_texture);
bitmap_width = ceilf (texture_width * scale); bitmap_width = (int) ceilf (texture_width * scale);
bitmap_height = ceilf (texture_height * scale); bitmap_height = (int) ceilf (texture_height * scale);
spa_meta_bitmap->size.width = bitmap_width; spa_meta_bitmap->size.width = bitmap_width;
spa_meta_bitmap->size.height = bitmap_height; spa_meta_bitmap->size.height = bitmap_height;

View file

@ -21,8 +21,6 @@
#pragma once #pragma once
#include <glib-object.h> #include <glib-object.h>
#include <spa/param/video/format-utils.h>
#include <spa/buffer/meta.h>
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/meta-cursor-renderer.h" #include "backends/meta-cursor-renderer.h"
@ -54,6 +52,10 @@ typedef enum _MetaScreenCastPaintPhase
META_SCREEN_CAST_PAINT_PHASE_PRE_SWAP_BUFFER, META_SCREEN_CAST_PAINT_PHASE_PRE_SWAP_BUFFER,
} MetaScreenCastPaintPhase; } MetaScreenCastPaintPhase;
/* Declare some SPA types to avoid including the headers in too many places. */
struct spa_meta_cursor;
struct spa_video_info_raw;
#define META_TYPE_SCREEN_CAST_STREAM_SRC (meta_screen_cast_stream_src_get_type ()) #define META_TYPE_SCREEN_CAST_STREAM_SRC (meta_screen_cast_stream_src_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaScreenCastStreamSrc, G_DECLARE_DERIVABLE_TYPE (MetaScreenCastStreamSrc,
meta_screen_cast_stream_src, meta_screen_cast_stream_src,

View file

@ -16,10 +16,17 @@
* *
*/ */
/* Till https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4065 is fixed */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#include "config.h" #include "config.h"
#include "backends/meta-screen-cast-virtual-stream-src.h" #include "backends/meta-screen-cast-virtual-stream-src.h"
#include <spa/param/video/format-utils.h>
#include <spa/buffer/meta.h>
#include "backends/meta-crtc-mode.h" #include "backends/meta-crtc-mode.h"
#include "backends/meta-cursor-tracker-private.h" #include "backends/meta-cursor-tracker-private.h"
#include "backends/meta-eis-viewport.h" #include "backends/meta-eis-viewport.h"
@ -651,8 +658,8 @@ create_virtual_monitor (MetaScreenCastVirtualStreamSrc *virtual_src,
g_autofree char *serial = NULL; g_autofree char *serial = NULL;
g_autoptr (MetaVirtualMonitorInfo) info = NULL; g_autoptr (MetaVirtualMonitorInfo) info = NULL;
width = video_format->size.width; width = (int) video_format->size.width;
height = video_format->size.height; height = (int) video_format->size.height;
refresh_rate = ((float) video_format->max_framerate.num / refresh_rate = ((float) video_format->max_framerate.num /
video_format->max_framerate.denom); video_format->max_framerate.denom);
serial = g_strdup_printf ("0x%.6x", ++virtual_monitor_src_seq); serial = g_strdup_printf ("0x%.6x", ++virtual_monitor_src_seq);
@ -790,3 +797,5 @@ meta_screen_cast_virtual_stream_src_class_init (MetaScreenCastVirtualStreamSrcCl
src_class->notify_params_updated = src_class->notify_params_updated =
meta_screen_cast_virtual_stream_src_notify_params_updated; meta_screen_cast_virtual_stream_src_notify_params_updated;
} }
#pragma GCC diagnostic pop

View file

@ -158,8 +158,8 @@ maybe_draw_cursor_sprite (MetaScreenCastWindowStreamSrc *window_src,
meta_cursor_sprite_get_hotspot (cursor_sprite, &hotspot_x, &hotspot_y); meta_cursor_sprite_get_hotspot (cursor_sprite, &hotspot_x, &hotspot_y);
width = cogl_texture_get_width (cursor_texture) * scale; width = (int) (cogl_texture_get_width (cursor_texture) * scale);
height = cogl_texture_get_height (cursor_texture) * scale; height = (int) (cogl_texture_get_height (cursor_texture) * scale);
cursor_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, cursor_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
width, height); width, height);

View file

@ -157,7 +157,7 @@ paint_damage_region (ClutterStageWindow *stage_window,
if (G_UNLIKELY (overlay_blue == NULL)) if (G_UNLIKELY (overlay_blue == NULL))
{ {
overlay_blue = cogl_pipeline_new (ctx); overlay_blue = cogl_pipeline_new (ctx);
cogl_color_init_from_4f (&blue_color, 0.0, 0.0, 0.2, 0.2); cogl_color_init_from_4f (&blue_color, 0.0f, 0.0f, 0.2f, 0.2f);
cogl_pipeline_set_color (overlay_blue, &blue_color); cogl_pipeline_set_color (overlay_blue, &blue_color);
} }
@ -184,7 +184,7 @@ paint_damage_region (ClutterStageWindow *stage_window,
if (G_UNLIKELY (overlay_red == NULL)) if (G_UNLIKELY (overlay_red == NULL))
{ {
overlay_red = cogl_pipeline_new (ctx); overlay_red = cogl_pipeline_new (ctx);
cogl_color_init_from_4f (&red_color, 0.2, 0.0, 0.0, 0.2); cogl_color_init_from_4f (&red_color, 0.2f, 0.0f, 0.0f, 0.2f);
cogl_pipeline_set_color (overlay_red, &red_color); cogl_pipeline_set_color (overlay_red, &red_color);
} }
@ -577,7 +577,7 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
{ {
queued_redraw_clip = queued_redraw_clip =
scale_offset_and_clamp_region (fb_clip_region, scale_offset_and_clamp_region (fb_clip_region,
1.0 / fb_scale, 1.0f / fb_scale,
view_rect.x, view_rect.x,
view_rect.y); view_rect.y);
} }
@ -658,7 +658,7 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
*/ */
g_clear_pointer (&redraw_clip, mtk_region_unref); g_clear_pointer (&redraw_clip, mtk_region_unref);
redraw_clip = scale_offset_and_clamp_region (fb_clip_region, redraw_clip = scale_offset_and_clamp_region (fb_clip_region,
1.0 / fb_scale, 1.0f / fb_scale,
view_rect.x, view_rect.x,
view_rect.y); view_rect.y);
} }

View file

@ -375,17 +375,17 @@ queue_redraw_clutter_rect (MetaStage *stage,
graphene_rect_t *rect) graphene_rect_t *rect)
{ {
MtkRectangle clip = { MtkRectangle clip = {
.x = floorf (rect->origin.x), .x = (int) floorf (rect->origin.x),
.y = floorf (rect->origin.y), .y = (int) floorf (rect->origin.y),
.width = ceilf (rect->size.width), .width = (int) ceilf (rect->size.width),
.height = ceilf (rect->size.height) .height = (int) ceilf (rect->size.height)
}; };
GList *l; GList *l;
/* Since we're flooring the coordinates, we need to enlarge the clip by the /* Since we're flooring the coordinates, we need to enlarge the clip by the
* difference between the actual coordinate and the floored value */ * difference between the actual coordinate and the floored value */
clip.width += ceilf (rect->origin.x - clip.x) * 2; clip.width += (int) ceilf (rect->origin.x - clip.x) * 2;
clip.height += ceilf (rect->origin.y - clip.y) * 2; clip.height += (int) ceilf (rect->origin.y - clip.y) * 2;
for (l = clutter_stage_peek_stage_views (CLUTTER_STAGE (stage)); for (l = clutter_stage_peek_stage_views (CLUTTER_STAGE (stage));
l; l;

View file

@ -227,7 +227,7 @@ meta_bezier_sample (MetaBezier *b)
while (t < 1.0) while (t < 1.0)
{ {
meta_bezier_advance (b, t * META_BEZIER_MAX_LENGTH, &pos); meta_bezier_advance (b, (int) (t * META_BEZIER_MAX_LENGTH), &pos);
if (pos.x < N) if (pos.x < N)
{ {
if (points[MAX (pos.x - 1, 0)] == -1) if (points[MAX (pos.x - 1, 0)] == -1)
@ -256,7 +256,7 @@ meta_bezier_sample (MetaBezier *b)
while (i < N - 1) while (i < N - 1)
{ {
double *current = &points[++i]; double *current = &points[++i];
int prev = points[i - 1]; int prev = (int) points[i - 1];
if (*current == -1.0) if (*current == -1.0)
{ {
@ -266,7 +266,7 @@ meta_bezier_sample (MetaBezier *b)
do do
{ {
next = points[++next_idx]; next = (int) points[++next_idx];
} while (next == -1.0 && next_idx < N); /* N-1 is guaranteed valid */ } while (next == -1.0 && next_idx < N); /* N-1 is guaranteed valid */
delta = (next - prev) / (next_idx - i + 1); delta = (next - prev) / (next_idx - i + 1);
@ -274,7 +274,7 @@ meta_bezier_sample (MetaBezier *b)
while (i < next_idx) while (i < next_idx)
{ {
*current = prev + delta; *current = prev + delta;
prev = *current; prev = (int) *current;
current++; current++;
i++; i++;
} }
@ -292,7 +292,7 @@ sqrti (int number)
/* The GCC built-in with SSE2 (sqrtsd) is up to twice as fast as /* The GCC built-in with SSE2 (sqrtsd) is up to twice as fast as
* the pure integer code below. It is also more accurate. * the pure integer code below. It is also more accurate.
*/ */
return __builtin_sqrt (number); return (int) __builtin_sqrt (number);
#else #else
/* This is a fixed point implementation of the Quake III sqrt algorithm, /* This is a fixed point implementation of the Quake III sqrt algorithm,
* described, for example, at * described, for example, at
@ -338,7 +338,7 @@ sqrti (int number)
* addition out, and it all goes pear shape, since without it, the bits * addition out, and it all goes pear shape, since without it, the bits
* in the float will not be correctly aligned. * in the float will not be correctly aligned.
*/ */
flt2.f = flt.f + 2.0; flt2.f = flt.f + 2.0f;
flt2.i &= 0x7FFFFF; flt2.i &= 0x7FFFFF;
/* Now we correct the estimate */ /* Now we correct the estimate */
@ -382,8 +382,8 @@ meta_bezier_init (MetaBezier *b,
y_3 = 1.0; y_3 = 1.0;
_FixedT t; _FixedT t;
int i; int i;
int xp = x_0; int xp = (int) x_0;
int yp = y_0; int yp = (int) y_0;
_FixedT length[CBZ_T_SAMPLES + 1]; _FixedT length[CBZ_T_SAMPLES + 1];
g_warn_if_fail (x_1 >= 0.0 && x_1 <= 1.0); g_warn_if_fail (x_1 >= 0.0 && x_1 <= 1.0);
@ -403,17 +403,17 @@ meta_bezier_init (MetaBezier *b,
x0, y0, x1, y1, x2, y2, x3, y3); x0, y0, x1, y1, x2, y2, x3, y3);
#endif #endif
b->dx = x_0; b->dx = (int) x_0;
b->dy = y_0; b->dy = (int) y_0;
b->cx = 3 * (x_1 - x_0); b->cx = (int) (3 * (x_1 - x_0));
b->cy = 3 * (y_1 - y_0); b->cy = (int) (3 * (y_1 - y_0));
b->bx = 3 * (x_2 - x_1) - b->cx; b->bx = (int) (3 * (x_2 - x_1) - b->cx);
b->by = 3 * (y_2 - y_1) - b->cy; b->by = (int) (3 * (y_2 - y_1) - b->cy);
b->ax = x_3 - 3 * x_2 + 3 * x_1 - x_0; b->ax = (int) (x_3 - 3 * x_2 + 3 * x_1 - x_0);
b->ay = y_3 - 3 * y_2 + 3 * y_1 - y_0; b->ay = (int) (y_3 - 3 * y_2 + 3 * y_1 - y_0);
#if 0 #if 0
g_debug ("Cooeficients {{%d,%d},{%d,%d},{%d,%d},{%d,%d}}", g_debug ("Cooeficients {{%d,%d},{%d,%d},{%d,%d},{%d,%d}}",

View file

@ -771,8 +771,8 @@ scale_and_transform_cursor_sprite_cpu (uint8_t *pixels,
int image_width; int image_width;
int image_height; int image_height;
image_width = ceilf (width * scale); image_width = (int) ceilf (width * scale);
image_height = ceilf (height * scale); image_height = (int) ceilf (height * scale);
target_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, target_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
image_width, image_width,

View file

@ -1565,8 +1565,8 @@ meta_input_device_native_new_in_impl (MetaSeatImpl *seat_impl,
if (libinput_device_get_size (libinput_device, &width, &height) == 0) if (libinput_device_get_size (libinput_device, &width, &height) == 0)
{ {
device->device_aspect_ratio = width / height; device->device_aspect_ratio = width / height;
device->width = width; device->width = (int) width;
device->height = height; device->height = (int) height;
} }
device->group = (intptr_t) libinput_device_get_device_group (libinput_device); device->group = (intptr_t) libinput_device_get_device_group (libinput_device);
@ -1678,20 +1678,32 @@ meta_input_device_native_translate_coordinates_in_impl (ClutterInputDevice *devi
} }
graphene_matrix_transform_point (&device_evdev->device_matrix, graphene_matrix_transform_point (&device_evdev->device_matrix,
&GRAPHENE_POINT_INIT (min_x, min_y), &min_point); &GRAPHENE_POINT_INIT ((float) min_x,
(float) min_y),
&min_point);
min_x = min_point.x; min_x = min_point.x;
min_y = min_point.y; min_y = min_point.y;
graphene_matrix_transform_point (&device_evdev->device_matrix, graphene_matrix_transform_point (&device_evdev->device_matrix,
&GRAPHENE_POINT_INIT (max_x, max_y), &max_point); &GRAPHENE_POINT_INIT ((float) max_x,
(float) max_y),
&max_point);
max_x = max_point.x; max_x = max_point.x;
max_y = max_point.y; max_y = max_point.y;
graphene_matrix_transform_point (&device_evdev->device_matrix, graphene_matrix_transform_point (&device_evdev->device_matrix,
&GRAPHENE_POINT_INIT (x_d, y_d), &pos_point); &GRAPHENE_POINT_INIT ((float) x_d,
(float) y_d),
&pos_point);
x_d = pos_point.x; x_d = pos_point.x;
y_d = pos_point.y; y_d = pos_point.y;
*x = CLAMP (x_d, MIN (min_x, max_x), MAX (min_x, max_x)) * stage_width; *x = (float) (CLAMP (x_d,
*y = CLAMP (y_d, MIN (min_y, max_y), MAX (min_y, max_y)) * stage_height; MIN (min_x, max_x),
MAX (min_x, max_x)) *
stage_width);
*y = (float) (CLAMP (y_d,
MIN (min_y, max_y),
MAX (min_y, max_y)) *
stage_height);
} }
MetaInputDeviceMapping MetaInputDeviceMapping

View file

@ -128,10 +128,10 @@ meta_input_device_tool_native_set_pressure_curve_in_impl (ClutterInputDeviceTool
curve[2] >= 0 && curve[2] <= 1 && curve[2] >= 0 && curve[2] <= 1 &&
curve[3] >= 0 && curve[3] <= 1); curve[3] >= 0 && curve[3] <= 1);
p1.x = curve[0]; p1.x = (float) curve[0];
p1.y = curve[1]; p1.y = (float) curve[1];
p2.x = curve[2]; p2.x = (float) curve[2];
p2.y = curve[3]; p2.y = (float) curve[3];
evdev_tool = META_INPUT_DEVICE_TOOL_NATIVE (tool); evdev_tool = META_INPUT_DEVICE_TOOL_NATIVE (tool);
if (!graphene_point_equal (&p1, &evdev_tool->pressure_curve[0]) || if (!graphene_point_equal (&p1, &evdev_tool->pressure_curve[0]) ||

View file

@ -676,10 +676,10 @@ meta_input_settings_native_set_tablet_area (MetaInputSettings *settings,
gfloat offset_x; gfloat offset_x;
gfloat offset_y; gfloat offset_y;
scale_x = 1. / (1. - (padding_left + padding_right)); scale_x = (float) (1.0 / (1.0 - (padding_left + padding_right)));
scale_y = 1. / (1. - (padding_top + padding_bottom)); scale_y = (float) (1.0 / (1.0 - (padding_top + padding_bottom)));
offset_x = -padding_left * scale_x; offset_x = (float) (-padding_left * scale_x);
offset_y = -padding_top * scale_y; offset_y = (float) (-padding_top * scale_y);
gfloat matrix[6] = { scale_x, 0., offset_x, gfloat matrix[6] = { scale_x, 0., offset_x,
0., scale_y, offset_y }; 0., scale_y, offset_y };

View file

@ -598,14 +598,14 @@ encode_u16_chromaticity (double value)
{ {
/* CTA-861.3 HDR Static Metadata Extension, 3.2.1 Static Metadata Type 1 */ /* CTA-861.3 HDR Static Metadata Extension, 3.2.1 Static Metadata Type 1 */
value = MAX (MIN (value, 1.0), 0.0); value = MAX (MIN (value, 1.0), 0.0);
return round (value / 0.00002); return (uint16_t) round (value / 0.00002);
} }
static uint16_t static uint16_t
encode_u16_max_luminance (double value) encode_u16_max_luminance (double value)
{ {
/* CTA-861.3 HDR Static Metadata Extension, 3.2.1 Static Metadata Type 1 */ /* CTA-861.3 HDR Static Metadata Extension, 3.2.1 Static Metadata Type 1 */
return round (MAX (MIN (value, 65535.0), 0.0)); return (uint16_t) round (MAX (MIN (value, 65535.0), 0.0));
} }
static uint16_t static uint16_t
@ -613,21 +613,21 @@ encode_u16_min_luminance (double value)
{ {
/* CTA-861.3 HDR Static Metadata Extension, 3.2.1 Static Metadata Type 1 */ /* CTA-861.3 HDR Static Metadata Extension, 3.2.1 Static Metadata Type 1 */
value = MAX (MIN (value, 6.5535), 0.0); value = MAX (MIN (value, 6.5535), 0.0);
return round (value / 0.0001); return (uint16_t) round (value / 0.0001);
} }
static uint16_t static uint16_t
encode_u16_max_cll (double value) encode_u16_max_cll (double value)
{ {
/* CTA-861.3 HDR Static Metadata Extension, 3.2.1 Static Metadata Type 1 */ /* CTA-861.3 HDR Static Metadata Extension, 3.2.1 Static Metadata Type 1 */
return round (MAX (MIN (value, 65535.0), 0.0)); return (uint16_t) round (MAX (MIN (value, 65535.0), 0.0));
} }
static uint16_t static uint16_t
encode_u16_max_fall (double value) encode_u16_max_fall (double value)
{ {
/* CTA-861.3 HDR Static Metadata Extension, 3.2.1 Static Metadata Type 1 */ /* CTA-861.3 HDR Static Metadata Extension, 3.2.1 Static Metadata Type 1 */
return round (MAX (MIN (value, 65535.0), 0.0)); return (uint16_t) round (MAX (MIN (value, 65535.0), 0.0));
} }
void void

View file

@ -599,8 +599,8 @@ meta_kms_crtc_determine_deadline (MetaKmsCrtc *crtc,
{ {
next_presentation_us = 0; next_presentation_us = 0;
next_deadline_us = next_deadline_us =
s2us (vblank.reply.tval_sec) + vblank.reply.tval_usec + 0.5 + (int64_t) (s2us (vblank.reply.tval_sec) + vblank.reply.tval_usec + 0.5 +
G_USEC_PER_SEC / MINIMUM_REFRESH_RATE; G_USEC_PER_SEC / MINIMUM_REFRESH_RATE);
} }
else else
{ {
@ -611,8 +611,8 @@ meta_kms_crtc_determine_deadline (MetaKmsCrtc *crtc,
drm_mode = &crtc->current_state.drm_mode; drm_mode = &crtc->current_state.drm_mode;
next_presentation_us = next_presentation_us =
s2us (vblank.reply.tval_sec) + vblank.reply.tval_usec + 0.5 + (int64_t) (s2us (vblank.reply.tval_sec) + vblank.reply.tval_usec + 0.5 +
G_USEC_PER_SEC / meta_calculate_drm_mode_refresh_rate (drm_mode); G_USEC_PER_SEC / meta_calculate_drm_mode_refresh_rate (drm_mode));
/* /*
* 1 * 1

View file

@ -268,12 +268,12 @@ calculate_cursor_rect (CrtcStateImpl *crtc_state_impl,
int buffer_width, buffer_height; int buffer_width, buffer_height;
graphene_rect_t cursor_rect; graphene_rect_t cursor_rect;
crtc_x = (x - crtc_state_impl->layout.origin.x) * crtc_state_impl->scale; crtc_x = (int) ((x - crtc_state_impl->layout.origin.x) * crtc_state_impl->scale);
crtc_y = (y - crtc_state_impl->layout.origin.y) * crtc_state_impl->scale; crtc_y = (int) ((y - crtc_state_impl->layout.origin.y) * crtc_state_impl->scale);
crtc_width = roundf (crtc_state_impl->layout.size.width * crtc_width = (int) roundf (crtc_state_impl->layout.size.width *
crtc_state_impl->scale); crtc_state_impl->scale);
crtc_height = roundf (crtc_state_impl->layout.size.height * crtc_height = (int) roundf (crtc_state_impl->layout.size.height *
crtc_state_impl->scale); crtc_state_impl->scale);
meta_monitor_transform_transform_point (crtc_state_impl->transform, meta_monitor_transform_transform_point (crtc_state_impl->transform,
&crtc_width, &crtc_height, &crtc_width, &crtc_height,
@ -401,10 +401,10 @@ maybe_update_cursor_plane (MetaKmsCursorManagerImpl *cursor_manager_impl,
.height = meta_fixed_16_from_int (height), .height = meta_fixed_16_from_int (height),
}; };
dst_rect = (MtkRectangle) { dst_rect = (MtkRectangle) {
.x = round (cursor_rect.origin.x), .x = (int) round (cursor_rect.origin.x),
.y = round (cursor_rect.origin.y), .y = (int) round (cursor_rect.origin.y),
.width = round (cursor_rect.size.width), .width = (int) round (cursor_rect.size.width),
.height = round (cursor_rect.size.height), .height = (int) round (cursor_rect.size.height),
}; };
plane_assignment = meta_kms_update_assign_plane (update, plane_assignment = meta_kms_update_assign_plane (update,

View file

@ -217,7 +217,7 @@ meta_fixed_16_to_int (MetaFixed16 fixed)
static inline MetaFixed16 static inline MetaFixed16
meta_fixed_16_from_double (double d) meta_fixed_16_from_double (double d)
{ {
return d * (1 << 16); return (MetaFixed16) (d * (1 << 16));
} }
static inline double static inline double

View file

@ -36,7 +36,7 @@ meta_calculate_drm_mode_refresh_rate (const drmModeModeInfo *drm_mode)
if (drm_mode->vscan > 1) if (drm_mode->vscan > 1)
denominator *= drm_mode->vscan; denominator *= drm_mode->vscan;
return numerator / denominator; return (float) (numerator / denominator);
} }
int64_t int64_t

View file

@ -36,7 +36,7 @@
#include "backends/native/meta-crtc-kms.h" #include "backends/native/meta-crtc-kms.h"
#include "backends/native/meta-crtc-mode-kms.h" #include "backends/native/meta-crtc-mode-kms.h"
#define SYNC_TOLERANCE_HZ 0.001 #define SYNC_TOLERANCE_HZ 0.001f
struct _MetaOutputKms struct _MetaOutputKms
{ {
@ -133,7 +133,7 @@ add_common_modes (MetaOutputInfo *output_info,
max_pixel_clock = MAX (max_pixel_clock, crtc_mode_info->pixel_clock_khz); max_pixel_clock = MAX (max_pixel_clock, crtc_mode_info->pixel_clock_khz);
} }
max_refresh_rate = MAX (max_refresh_rate, 60.0); max_refresh_rate = MAX (max_refresh_rate, 60.0f);
max_refresh_rate += SYNC_TOLERANCE_HZ; max_refresh_rate += SYNC_TOLERANCE_HZ;
kms_device = meta_gpu_kms_get_kms_device (gpu_kms); kms_device = meta_gpu_kms_get_kms_device (gpu_kms);

View file

@ -374,7 +374,7 @@ get_closest_border (GArray *borders,
MetaVector2 delta; MetaVector2 delta;
float distance_2; float distance_2;
MetaBorder *closest_border = NULL; MetaBorder *closest_border = NULL;
float closest_distance_2 = DBL_MAX; float closest_distance_2 = FLT_MAX;
unsigned int i; unsigned int i;
for (i = 0; i < borders->len; i++) for (i = 0; i < borders->len; i++)
@ -408,7 +408,7 @@ clamp_to_border (MetaBorder *border,
if (meta_border_is_horizontal (border)) if (meta_border_is_horizontal (border))
{ {
if (*motion_dir & META_BORDER_MOTION_DIRECTION_POSITIVE_Y) if (*motion_dir & META_BORDER_MOTION_DIRECTION_POSITIVE_Y)
motion->b.y = border->line.a.y - min_edge_distance; motion->b.y = (float) (border->line.a.y - min_edge_distance);
else else
motion->b.y = border->line.a.y; motion->b.y = border->line.a.y;
*motion_dir &= ~(META_BORDER_MOTION_DIRECTION_POSITIVE_Y | *motion_dir &= ~(META_BORDER_MOTION_DIRECTION_POSITIVE_Y |
@ -417,7 +417,7 @@ clamp_to_border (MetaBorder *border,
else else
{ {
if (*motion_dir & META_BORDER_MOTION_DIRECTION_POSITIVE_X) if (*motion_dir & META_BORDER_MOTION_DIRECTION_POSITIVE_X)
motion->b.x = border->line.a.x - min_edge_distance; motion->b.x = (float) (border->line.a.x - min_edge_distance);
else else
motion->b.x = border->line.a.x; motion->b.x = border->line.a.x;
*motion_dir &= ~(META_BORDER_MOTION_DIRECTION_POSITIVE_X | *motion_dir &= ~(META_BORDER_MOTION_DIRECTION_POSITIVE_X |
@ -570,24 +570,24 @@ closest_point_behind_border (MetaBorder *border,
case META_BORDER_MOTION_DIRECTION_POSITIVE_X: case META_BORDER_MOTION_DIRECTION_POSITIVE_X:
case META_BORDER_MOTION_DIRECTION_NEGATIVE_X: case META_BORDER_MOTION_DIRECTION_NEGATIVE_X:
if (border->blocking_directions == META_BORDER_MOTION_DIRECTION_POSITIVE_X) if (border->blocking_directions == META_BORDER_MOTION_DIRECTION_POSITIVE_X)
*sx = border->line.a.x - wl_fixed_to_double (1); *sx = border->line.a.x - (float) wl_fixed_to_double (1);
else else
*sx = border->line.a.x + wl_fixed_to_double (1); *sx = border->line.a.x + (float) wl_fixed_to_double (1);
if (*sy < border->line.a.y) if (*sy < border->line.a.y)
*sy = border->line.a.y + wl_fixed_to_double (1); *sy = border->line.a.y + (float) wl_fixed_to_double (1);
else if (*sy > border->line.b.y) else if (*sy > border->line.b.y)
*sy = border->line.b.y - wl_fixed_to_double (1); *sy = border->line.b.y - (float) wl_fixed_to_double (1);
break; break;
case META_BORDER_MOTION_DIRECTION_POSITIVE_Y: case META_BORDER_MOTION_DIRECTION_POSITIVE_Y:
case META_BORDER_MOTION_DIRECTION_NEGATIVE_Y: case META_BORDER_MOTION_DIRECTION_NEGATIVE_Y:
if (border->blocking_directions == META_BORDER_MOTION_DIRECTION_POSITIVE_Y) if (border->blocking_directions == META_BORDER_MOTION_DIRECTION_POSITIVE_Y)
*sy = border->line.a.y - wl_fixed_to_double (1); *sy = border->line.a.y - (float) wl_fixed_to_double (1);
else else
*sy = border->line.a.y + wl_fixed_to_double (1); *sy = border->line.a.y + (float) wl_fixed_to_double (1);
if (*sx < border->line.a.x) if (*sx < border->line.a.x)
*sx = border->line.a.x + wl_fixed_to_double (1); *sx = border->line.a.x + (float) wl_fixed_to_double (1);
else if (*sx > (border->line.b.x)) else if (*sx > (border->line.b.x))
*sx = border->line.b.x - wl_fixed_to_double (1); *sx = border->line.b.x - (float) wl_fixed_to_double (1);
break; break;
} }
} }
@ -621,8 +621,8 @@ meta_pointer_constraint_impl_native_ensure_constrained (MetaPointerConstraintImp
y != constraint_impl_native->origin.y) y != constraint_impl_native->origin.y)
{ {
clutter_seat_warp_pointer (seat, clutter_seat_warp_pointer (seat,
constraint_impl_native->origin.x, (int) constraint_impl_native->origin.x,
constraint_impl_native->origin.y); (int) constraint_impl_native->origin.y);
} }
} }
else if (!mtk_region_contains_point (region, (int) rel_x, (int) rel_y)) else if (!mtk_region_contains_point (region, (int) rel_x, (int) rel_y))
@ -652,8 +652,8 @@ meta_pointer_constraint_impl_native_ensure_constrained (MetaPointerConstraintImp
closest_point_behind_border (closest_border, &rel_x, &rel_y); closest_point_behind_border (closest_border, &rel_x, &rel_y);
clutter_seat_warp_pointer (seat, clutter_seat_warp_pointer (seat,
rel_x + constraint_impl_native->origin.x, (int) (rel_x + constraint_impl_native->origin.x),
rel_y + constraint_impl_native->origin.y); (int) (rel_y + constraint_impl_native->origin.y));
} }
} }

View file

@ -686,7 +686,7 @@ meta_seat_impl_notify_relative_motion_in_impl (MetaSeatImpl *seat_impl,
ClutterEvent *event; ClutterEvent *event;
ClutterModifierType modifiers; ClutterModifierType modifiers;
float x, y, cur_x, cur_y; float x, y, cur_x, cur_y;
double dx_constrained, dy_constrained; float dx_constrained, dy_constrained;
if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE) if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE)
{ {
@ -950,8 +950,8 @@ notify_scroll (ClutterInputDevice *input_device,
NULL, NULL,
modifiers, modifiers,
GRAPHENE_POINT_INIT (x, y), GRAPHENE_POINT_INIT (x, y),
GRAPHENE_POINT_INIT (scroll_factor * dx, GRAPHENE_POINT_INIT ((float) (scroll_factor * dx),
scroll_factor * dy), (float) (scroll_factor * dy)),
scroll_source, scroll_source,
flags); flags);
@ -1004,10 +1004,10 @@ check_notify_discrete_scroll (MetaSeatImpl *seat_impl,
{ {
int i, n_xscrolls, n_yscrolls; int i, n_xscrolls, n_yscrolls;
n_xscrolls = floor ((fabs (seat_impl->accum_scroll_dx) + DBL_EPSILON) / n_xscrolls = (int) floor ((fabs (seat_impl->accum_scroll_dx) + DBL_EPSILON) /
DISCRETE_SCROLL_STEP); DISCRETE_SCROLL_STEP);
n_yscrolls = floor ((fabs (seat_impl->accum_scroll_dy) + DBL_EPSILON) / n_yscrolls = (int) floor ((fabs (seat_impl->accum_scroll_dy) + DBL_EPSILON) /
DISCRETE_SCROLL_STEP); DISCRETE_SCROLL_STEP);
for (i = 0; i < n_xscrolls; i++) for (i = 0; i < n_xscrolls; i++)
{ {
@ -1043,12 +1043,12 @@ meta_seat_impl_notify_scroll_continuous_in_impl (MetaSeatImpl *seat_
if (finish_flags & CLUTTER_SCROLL_FINISHED_HORIZONTAL) if (finish_flags & CLUTTER_SCROLL_FINISHED_HORIZONTAL)
seat_impl->accum_scroll_dx = 0; seat_impl->accum_scroll_dx = 0;
else else
seat_impl->accum_scroll_dx += dx; seat_impl->accum_scroll_dx += (float) dx;
if (finish_flags & CLUTTER_SCROLL_FINISHED_VERTICAL) if (finish_flags & CLUTTER_SCROLL_FINISHED_VERTICAL)
seat_impl->accum_scroll_dy = 0; seat_impl->accum_scroll_dy = 0;
else else
seat_impl->accum_scroll_dy += dy; seat_impl->accum_scroll_dy += (float) dy;
notify_scroll (input_device, time_us, dx, dy, scroll_source, notify_scroll (input_device, time_us, dx, dy, scroll_source,
finish_flags, FALSE); finish_flags, FALSE);
@ -1113,7 +1113,7 @@ meta_seat_impl_notify_discrete_scroll_in_impl (MetaSeatImpl *seat_impl,
if (should_reset_discrete_acc (dx_value120, evdev_device->value120.last_dx)) if (should_reset_discrete_acc (dx_value120, evdev_device->value120.last_dx))
evdev_device->value120.acc_dx = 0; evdev_device->value120.acc_dx = 0;
evdev_device->value120.last_dx = dx_value120; evdev_device->value120.last_dx = (int32_t) dx_value120;
} }
if (dy_value120 != 0) if (dy_value120 != 0)
@ -1121,11 +1121,11 @@ meta_seat_impl_notify_discrete_scroll_in_impl (MetaSeatImpl *seat_impl,
if (should_reset_discrete_acc (dy_value120, evdev_device->value120.last_dy)) if (should_reset_discrete_acc (dy_value120, evdev_device->value120.last_dy))
evdev_device->value120.acc_dy = 0; evdev_device->value120.acc_dy = 0;
evdev_device->value120.last_dy = dy_value120; evdev_device->value120.last_dy = (int32_t) dy_value120;
} }
evdev_device->value120.acc_dx += dx_value120; evdev_device->value120.acc_dx += (int32_t) dx_value120;
evdev_device->value120.acc_dy += dy_value120; evdev_device->value120.acc_dy += (int32_t) dy_value120;
if (abs (evdev_device->value120.acc_dx) >= 60) if (abs (evdev_device->value120.acc_dx) >= 60)
{ {
@ -1192,7 +1192,7 @@ meta_seat_impl_notify_touch_event_in_impl (MetaSeatImpl *seat_impl,
input_device, input_device,
sequence, sequence,
modifiers, modifiers,
GRAPHENE_POINT_INIT (x, y)); GRAPHENE_POINT_INIT ((float) x, (float) y));
} }
queue_event (seat_impl, event); queue_event (seat_impl, event);
@ -1415,11 +1415,14 @@ notify_pinch_gesture_event (ClutterInputDevice *input_device,
input_device, input_device,
phase, phase,
n_fingers, n_fingers,
GRAPHENE_POINT_INIT (x, y), GRAPHENE_POINT_INIT ((float) x,
GRAPHENE_POINT_INIT (dx, dy), (float) y),
GRAPHENE_POINT_INIT (dx_unaccel, GRAPHENE_POINT_INIT ((float) dx,
dy_unaccel), (float) dy),
angle_delta, scale); GRAPHENE_POINT_INIT ((float) dx_unaccel,
(float) dy_unaccel),
(float) angle_delta,
(float) scale);
queue_event (seat_impl, event); queue_event (seat_impl, event);
} }
@ -1448,10 +1451,12 @@ notify_swipe_gesture_event (ClutterInputDevice *input_device,
input_device, input_device,
phase, phase,
n_fingers, n_fingers,
GRAPHENE_POINT_INIT (x, y), GRAPHENE_POINT_INIT ((float) x,
GRAPHENE_POINT_INIT (dx, dy), (float) y),
GRAPHENE_POINT_INIT (dx_unaccel, GRAPHENE_POINT_INIT ((float) dx,
dy_unaccel)); (float) dy),
GRAPHENE_POINT_INIT ((float) dx_unaccel,
(float) dy_unaccel));
queue_event (seat_impl, event); queue_event (seat_impl, event);
} }
@ -2080,13 +2085,20 @@ process_tablet_axis (MetaSeatImpl *seat_impl,
{ {
dx = libinput_event_tablet_tool_get_dx (tablet_event); dx = libinput_event_tablet_tool_get_dx (tablet_event);
dy = libinput_event_tablet_tool_get_dy (tablet_event); dy = libinput_event_tablet_tool_get_dy (tablet_event);
notify_relative_tool_motion_in_impl (device, time, dx, dy, axes); notify_relative_tool_motion_in_impl (device, time,
(float) dx, (float) dy,
axes);
} }
else else
{ {
x = libinput_event_tablet_tool_get_x_transformed (tablet_event, stage_width); x = libinput_event_tablet_tool_get_x_transformed (tablet_event,
y = libinput_event_tablet_tool_get_y_transformed (tablet_event, stage_height); (uint32_t) stage_width);
notify_absolute_motion_in_impl (device, time, x, y, axes); y = libinput_event_tablet_tool_get_y_transformed (tablet_event,
(uint32_t) stage_height);
notify_absolute_motion_in_impl (device, time,
(float) x,
(float) y,
axes);
} }
} }
@ -2157,8 +2169,10 @@ process_device_event (MetaSeatImpl *seat_impl,
meta_seat_impl_notify_relative_motion_in_impl (seat_impl, meta_seat_impl_notify_relative_motion_in_impl (seat_impl,
device, device,
time_us, time_us,
dx, dy, (float) dx,
dx_unaccel, dy_unaccel, (float) dy,
(float) dx_unaccel,
(float) dy_unaccel,
NULL); NULL);
break; break;
@ -2178,14 +2192,15 @@ process_device_event (MetaSeatImpl *seat_impl,
time_us = libinput_event_pointer_get_time_usec (motion_event); time_us = libinput_event_pointer_get_time_usec (motion_event);
x = libinput_event_pointer_get_absolute_x_transformed (motion_event, x = libinput_event_pointer_get_absolute_x_transformed (motion_event,
stage_width); (int) stage_width);
y = libinput_event_pointer_get_absolute_y_transformed (motion_event, y = libinput_event_pointer_get_absolute_y_transformed (motion_event,
stage_height); (int) stage_height);
meta_seat_impl_notify_absolute_motion_in_impl (seat_impl, meta_seat_impl_notify_absolute_motion_in_impl (seat_impl,
device, device,
time_us, time_us,
x, y, (float) x,
(float) y,
NULL); NULL);
break; break;
@ -2262,15 +2277,15 @@ process_device_event (MetaSeatImpl *seat_impl,
seat_slot = libinput_event_touch_get_seat_slot (touch_event); seat_slot = libinput_event_touch_get_seat_slot (touch_event);
time_us = libinput_event_touch_get_time_usec (touch_event); time_us = libinput_event_touch_get_time_usec (touch_event);
x = libinput_event_touch_get_x_transformed (touch_event, x = libinput_event_touch_get_x_transformed (touch_event,
stage_width); (int) stage_width);
y = libinput_event_touch_get_y_transformed (touch_event, y = libinput_event_touch_get_y_transformed (touch_event,
stage_height); (int) stage_height);
g_rw_lock_writer_lock (&seat_impl->state_lock); g_rw_lock_writer_lock (&seat_impl->state_lock);
touch_state = meta_seat_impl_acquire_touch_state_in_impl (seat_impl, seat_slot); touch_state = meta_seat_impl_acquire_touch_state_in_impl (seat_impl, seat_slot);
touch_state->coords.x = x; touch_state->coords.x = (float) x;
touch_state->coords.y = y; touch_state->coords.y = (float) y;
meta_input_device_native_translate_coordinates_in_impl (device, meta_input_device_native_translate_coordinates_in_impl (device,
seat_impl->viewports, seat_impl->viewports,
&touch_state->coords.x, &touch_state->coords.x,
@ -2335,16 +2350,16 @@ process_device_event (MetaSeatImpl *seat_impl,
seat_slot = libinput_event_touch_get_seat_slot (touch_event); seat_slot = libinput_event_touch_get_seat_slot (touch_event);
time_us = libinput_event_touch_get_time_usec (touch_event); time_us = libinput_event_touch_get_time_usec (touch_event);
x = libinput_event_touch_get_x_transformed (touch_event, x = libinput_event_touch_get_x_transformed (touch_event,
stage_width); (int) stage_width);
y = libinput_event_touch_get_y_transformed (touch_event, y = libinput_event_touch_get_y_transformed (touch_event,
stage_height); (int) stage_height);
g_rw_lock_writer_lock (&seat_impl->state_lock); g_rw_lock_writer_lock (&seat_impl->state_lock);
touch_state = meta_seat_impl_lookup_touch_state_in_impl (seat_impl, seat_slot); touch_state = meta_seat_impl_lookup_touch_state_in_impl (seat_impl, seat_slot);
if (touch_state) if (touch_state)
{ {
touch_state->coords.x = x; touch_state->coords.x = (float) x;
touch_state->coords.y = y; touch_state->coords.y = (float) y;
meta_input_device_native_translate_coordinates_in_impl (device, meta_input_device_native_translate_coordinates_in_impl (device,
seat_impl->viewports, seat_impl->viewports,
&touch_state->coords.x, &touch_state->coords.x,
@ -3721,12 +3736,12 @@ ensure_pointer_onscreen (MetaSeatImpl *seat_impl)
{ {
meta_viewport_info_get_view_info (seat_impl->viewports, i, meta_viewport_info_get_view_info (seat_impl->viewports, i,
&monitor_rect, NULL); &monitor_rect, NULL);
nearest_monitor_x = MIN (ABS (coords.x - monitor_rect.x), nearest_monitor_x = (int) MIN (ABS (coords.x - monitor_rect.x),
ABS (coords.x - ABS (coords.x -
monitor_rect.x + monitor_rect.width)); monitor_rect.x + monitor_rect.width));
nearest_monitor_y = MIN (ABS (coords.y - monitor_rect.y), nearest_monitor_y = (int) MIN (ABS (coords.y - monitor_rect.y),
ABS (coords.y - ABS (coords.y -
monitor_rect.y + monitor_rect.height)); monitor_rect.y + monitor_rect.height));
if (nearest_monitor_x < min_distance || if (nearest_monitor_x < min_distance ||
nearest_monitor_y < min_distance) nearest_monitor_y < min_distance)
{ {

View file

@ -216,11 +216,13 @@ notify_relative_motion_in_impl (GTask *task)
event->time_us = g_get_monotonic_time (); event->time_us = g_get_monotonic_time ();
meta_seat_impl_notify_relative_motion_in_impl (seat, meta_seat_impl_notify_relative_motion_in_impl (seat,
virtual_evdev->impl_state->device, virtual_evdev->impl_state->device,
event->time_us, event->time_us,
event->x, event->y, (float) event->x,
event->x, event->y, (float) event->y,
NULL); (float) event->x,
(float) event->y,
NULL);
g_task_return_boolean (task, TRUE); g_task_return_boolean (task, TRUE);
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
@ -262,10 +264,11 @@ notify_absolute_motion_in_impl (GTask *task)
event->time_us = g_get_monotonic_time (); event->time_us = g_get_monotonic_time ();
meta_seat_impl_notify_absolute_motion_in_impl (seat, meta_seat_impl_notify_absolute_motion_in_impl (seat,
virtual_evdev->impl_state->device, virtual_evdev->impl_state->device,
event->time_us, event->time_us,
event->x, event->y, (float) event->x,
NULL); (float) event->y,
NULL);
g_task_return_boolean (task, TRUE); g_task_return_boolean (task, TRUE);
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
@ -788,8 +791,8 @@ notify_touch_down_in_impl (GTask *task)
if (!touch_state) if (!touch_state)
goto out; goto out;
touch_state->coords.x = event->x; touch_state->coords.x = (float) event->x;
touch_state->coords.y = event->y; touch_state->coords.y = (float) event->y;
meta_seat_impl_notify_touch_event_in_impl (seat, meta_seat_impl_notify_touch_event_in_impl (seat,
virtual_evdev->impl_state->device, virtual_evdev->impl_state->device,
@ -848,8 +851,8 @@ notify_touch_motion_in_impl (GTask *task)
if (!touch_state) if (!touch_state)
goto out; goto out;
touch_state->coords.x = event->x; touch_state->coords.x = (float) event->x;
touch_state->coords.y = event->y; touch_state->coords.y = (float) event->y;
meta_seat_impl_notify_touch_event_in_impl (seat, meta_seat_impl_notify_touch_event_in_impl (seat,
virtual_evdev->impl_state->device, virtual_evdev->impl_state->device,

View file

@ -124,10 +124,10 @@ meta_barrier_impl_x11_new (MetaBarrier *barrier)
border = meta_barrier_get_border (barrier); border = meta_barrier_get_border (barrier);
allowed_motion_dirs = meta_border_get_allows_directions (border); allowed_motion_dirs = meta_border_get_allows_directions (border);
self->xbarrier = XFixesCreatePointerBarrier (xdisplay, root, self->xbarrier = XFixesCreatePointerBarrier (xdisplay, root,
border->line.a.x, (int) border->line.a.x,
border->line.a.y, (int) border->line.a.y,
border->line.b.x, (int) border->line.b.x,
border->line.b.y, (int) border->line.b.y,
allowed_motion_dirs, allowed_motion_dirs,
0, NULL); 0, NULL);

View file

@ -99,10 +99,10 @@ calculate_xrandr_refresh_rate (XRRModeInfo *xmode)
v_total = (float) xmode->vTotal; v_total = (float) xmode->vTotal;
if (xmode->modeFlags & RR_DoubleScan) if (xmode->modeFlags & RR_DoubleScan)
v_total *= 2.0; v_total *= 2.0f;
if (xmode->modeFlags & RR_Interlace) if (xmode->modeFlags & RR_Interlace)
v_total /= 2.0; v_total /= 2.0f;
return xmode->dotClock / (h_total * v_total); return xmode->dotClock / (h_total * v_total);
} }

View file

@ -336,7 +336,9 @@ meta_input_device_x11_get_dimensions (ClutterInputDevice *device,
else else
continue; continue;
*value = (valuator_info->max - valuator_info->min) * 1000 / valuator_info->resolution; *value = (unsigned int) ((valuator_info->max - valuator_info->min) *
1000 /
valuator_info->resolution);
} }
*width = w; *width = w;

View file

@ -242,7 +242,7 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
{ {
MetaBackend *backend = get_backend (settings); MetaBackend *backend = get_backend (settings);
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gfloat value = speed; gfloat value = (float) speed;
change_property (settings, device, "libinput Accel Speed", change_property (settings, device, "libinput Accel Speed",
XInternAtom (xdisplay, "FLOAT", False), XInternAtom (xdisplay, "FLOAT", False),
@ -711,13 +711,13 @@ device_query_area (MetaInputSettings *settings,
continue; continue;
if (valuator->label == abs_x) if (valuator->label == abs_x)
{ {
*x = valuator->min; *x = (int) valuator->min;
*width = valuator->max - valuator->min; *width = (int) (valuator->max - valuator->min);
} }
else if (valuator->label == abs_y) else if (valuator->label == abs_y)
{ {
*y = valuator->min; *y = (int) valuator->min;
*height = valuator->max - valuator->min; *height = (int) (valuator->max - valuator->min);
} }
} }
@ -747,10 +747,10 @@ meta_input_settings_x11_set_tablet_area (MetaInputSettings *settings,
if (!device_query_area (settings, device, &x, &y, &width, &height)) if (!device_query_area (settings, device, &x, &y, &width, &height))
return; return;
area[0] = (width * padding_left) + x; area[0] = (int32_t) ((width * padding_left) + x);
area[1] = (height * padding_top) + y; area[1] = (int32_t) ((height * padding_top) + y);
area[2] = width - (width * padding_right) + x; area[2] = (int32_t) (width - (width * padding_right) + x);
area[3] = height - (height * padding_bottom) + y; area[3] = (int32_t) (height - (height * padding_bottom) + y);
update_tablet_area (settings, device, area); update_tablet_area (settings, device, area);
} }
@ -772,9 +772,9 @@ meta_input_settings_x11_set_tablet_aspect_ratio (MetaInputSettings *settings,
dev_aspect = (double) dev_width / dev_height; dev_aspect = (double) dev_width / dev_height;
if (dev_aspect > aspect_ratio) if (dev_aspect > aspect_ratio)
dev_width = dev_height * aspect_ratio; dev_width = (int) (dev_height * aspect_ratio);
else if (dev_aspect < aspect_ratio) else if (dev_aspect < aspect_ratio)
dev_height = dev_width / aspect_ratio; dev_height = (int) (dev_width / aspect_ratio);
} }
area[0] = dev_x; area[0] = dev_x;

View file

@ -483,8 +483,8 @@ apply_crtc_assignments (MetaMonitorManager *manager,
* *
* Firefox and Evince apparently believe what X tells them. * Firefox and Evince apparently believe what X tells them.
*/ */
width_mm = (width / DPI_FALLBACK) * 25.4 + 0.5; width_mm = (int) ((width / DPI_FALLBACK) * 25.4 + 0.5);
height_mm = (height / DPI_FALLBACK) * 25.4 + 0.5; height_mm = (int) ((height / DPI_FALLBACK) * 25.4 + 0.5);
XRRSetScreenSize (manager_xrandr->xdisplay, DefaultRootWindow (manager_xrandr->xdisplay), XRRSetScreenSize (manager_xrandr->xdisplay, DefaultRootWindow (manager_xrandr->xdisplay),
width, height, width_mm, height_mm); width, height, width_mm, height_mm);

View file

@ -125,7 +125,7 @@ output_set_underscanning_xrandr (MetaOutput *output,
crtc_mode_info = meta_crtc_mode_get_info (crtc_config->mode); crtc_mode_info = meta_crtc_mode_get_info (crtc_config->mode);
prop = XInternAtom (xdisplay, "underscan hborder", False); prop = XInternAtom (xdisplay, "underscan hborder", False);
border_value = crtc_mode_info->width * 0.05; border_value = (uint32_t) (crtc_mode_info->width * 0.05);
xcb_randr_change_output_property (XGetXCBConnection (xdisplay), xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
(XID) meta_output_get_id (output), (XID) meta_output_get_id (output),
@ -134,7 +134,7 @@ output_set_underscanning_xrandr (MetaOutput *output,
1, &border_value); 1, &border_value);
prop = XInternAtom (xdisplay, "underscan vborder", False); prop = XInternAtom (xdisplay, "underscan vborder", False);
border_value = crtc_mode_info->height * 0.05; border_value = (uint32_t) (crtc_mode_info->height * 0.05);
xcb_randr_change_output_property (XGetXCBConnection (xdisplay), xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
(XID) meta_output_get_id (output), (XID) meta_output_get_id (output),
@ -195,8 +195,8 @@ normalize_backlight (MetaOutput *output,
{ {
const MetaOutputInfo *output_info = meta_output_get_info (output); const MetaOutputInfo *output_info = meta_output_get_info (output);
return round ((double) (hw_value - output_info->backlight_min) / return (int) round ((double) (hw_value - output_info->backlight_min) /
(output_info->backlight_max - output_info->backlight_min) * 100.0); (output_info->backlight_max - output_info->backlight_min) * 100.0);
} }
void void
@ -209,8 +209,8 @@ meta_output_xrandr_change_backlight (MetaOutputXrandr *output_xrandr,
Atom atom; Atom atom;
int hw_value; int hw_value;
hw_value = round ((double) value / 100.0 * output_info->backlight_max + hw_value = (int) round ((double) value / 100.0 * output_info->backlight_max +
output_info->backlight_min); output_info->backlight_min);
atom = XInternAtom (xdisplay, "Backlight", False); atom = XInternAtom (xdisplay, "Backlight", False);

View file

@ -1100,7 +1100,7 @@ emulate_motion (MetaSeatX11 *seat_x11,
CLUTTER_CURRENT_TIME, CLUTTER_CURRENT_TIME,
pointer, pointer,
NULL, 0, NULL, 0,
GRAPHENE_POINT_INIT (x, y), GRAPHENE_POINT_INIT ((float) x, (float) y),
GRAPHENE_POINT_INIT (0, 0), GRAPHENE_POINT_INIT (0, 0),
GRAPHENE_POINT_INIT (0, 0), GRAPHENE_POINT_INIT (0, 0),
GRAPHENE_POINT_INIT (0, 0), GRAPHENE_POINT_INIT (0, 0),
@ -1480,8 +1480,8 @@ translate_coords (MetaStageX11 *stage_x11,
clutter_actor_get_size (stage, &stage_width, &stage_height); clutter_actor_get_size (stage, &stage_width, &stage_height);
*x_out = CLAMP (event_x, 0, stage_width); *x_out = (float) CLAMP (event_x, 0, stage_width);
*y_out = CLAMP (event_y, 0, stage_height); *y_out = (float) CLAMP (event_y, 0, stage_height);
} }
static void static void
@ -1858,16 +1858,16 @@ meta_seat_x11_query_state (ClutterSeat *seat,
if (coords) if (coords)
{ {
coords->x = touch_info->x; coords->x = (float) touch_info->x;
coords->y = touch_info->y; coords->y = (float) touch_info->y;
} }
} }
else else
{ {
if (coords) if (coords)
{ {
coords->x = win_x; coords->x = (float) win_x;
coords->y = win_y; coords->y = (float) win_y;
} }
} }
@ -2498,7 +2498,8 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
tool, tool,
state, state,
GRAPHENE_POINT_INIT (x, y), GRAPHENE_POINT_INIT (x, y),
GRAPHENE_POINT_INIT (delta_x, delta_y), GRAPHENE_POINT_INIT ((float) delta_x,
(float) delta_y),
CLUTTER_SCROLL_SOURCE_UNKNOWN, CLUTTER_SCROLL_SOURCE_UNKNOWN,
CLUTTER_SCROLL_FINISHED_NONE); CLUTTER_SCROLL_FINISHED_NONE);

View file

@ -314,7 +314,7 @@ meta_stage_x11_realize (ClutterStageWindow *stage_window)
clutter_actor_get_size (CLUTTER_ACTOR (stage_impl->wrapper), &width, &height); clutter_actor_get_size (CLUTTER_ACTOR (stage_impl->wrapper), &width, &height);
stage_x11->onscreen = create_onscreen (clutter_backend->cogl_context, stage_x11->onscreen = create_onscreen (clutter_backend->cogl_context,
width, height); (int) width, (int) height);
if (META_IS_BACKEND_X11_CM (backend)) if (META_IS_BACKEND_X11_CM (backend))
{ {
@ -329,8 +329,8 @@ meta_stage_x11_realize (ClutterStageWindow *stage_window)
/* We just created a window of the size of the actor. No need to fix /* We just created a window of the size of the actor. No need to fix
the size of the stage, just update it. */ the size of the stage, just update it. */
stage_x11->xwin_width = width; stage_x11->xwin_width = (int) width;
stage_x11->xwin_height = height; stage_x11->xwin_height = (int) height;
if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (stage_x11->onscreen), &error)) if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (stage_x11->onscreen), &error))
{ {

View file

@ -145,10 +145,12 @@ meta_virtual_input_device_x11_notify_scroll_continuous (ClutterVirtualInputDevic
virtual_device_x11->accum_scroll_dx += dx; virtual_device_x11->accum_scroll_dx += dx;
virtual_device_x11->accum_scroll_dy += dy; virtual_device_x11->accum_scroll_dy += dy;
n_xscrolls = floor ((fabs (virtual_device_x11->accum_scroll_dx) + DBL_EPSILON) / n_xscrolls = (int) floor ((fabs (virtual_device_x11->accum_scroll_dx) +
DISCRETE_SCROLL_STEP); DBL_EPSILON) /
n_yscrolls = floor ((fabs (virtual_device_x11->accum_scroll_dy) + DBL_EPSILON) / DISCRETE_SCROLL_STEP);
DISCRETE_SCROLL_STEP); n_yscrolls = (int) floor ((fabs (virtual_device_x11->accum_scroll_dy) +
DBL_EPSILON) /
DISCRETE_SCROLL_STEP);
direction = virtual_device_x11->accum_scroll_dx > 0 ? CLUTTER_SCROLL_RIGHT direction = virtual_device_x11->accum_scroll_dx > 0 ? CLUTTER_SCROLL_RIGHT
: CLUTTER_SCROLL_LEFT; : CLUTTER_SCROLL_LEFT;

View file

@ -84,8 +84,8 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
view_scale = 1.0; view_scale = 1.0;
crtc_config = meta_crtc_get_config (crtc); crtc_config = meta_crtc_get_config (crtc);
width = roundf (crtc_config->layout.size.width * view_scale); width = (int) roundf (crtc_config->layout.size.width * view_scale);
height = roundf (crtc_config->layout.size.height * view_scale); height = (int) roundf (crtc_config->layout.size.height * view_scale);
fake_onscreen = create_offscreen (cogl_context, width, height); fake_onscreen = create_offscreen (cogl_context, width, height);

View file

@ -54,7 +54,7 @@
static inline int static inline int
round_to_fixed (float x) round_to_fixed (float x)
{ {
return roundf (x * FIXED_ONE); return (int) roundf (x * FIXED_ONE);
} }
/* Help macros to scale from OpenGL <-1,1> coordinates system to /* Help macros to scale from OpenGL <-1,1> coordinates system to

View file

@ -950,8 +950,8 @@ meta_compositor_real_before_paint (MetaCompositor *compositor,
stage_rect = (MtkRectangle) { stage_rect = (MtkRectangle) {
0, 0, 0, 0,
clutter_actor_get_width (stage), (int) clutter_actor_get_width (stage),
clutter_actor_get_height (stage), (int) clutter_actor_get_height (stage),
}; };
unobscured_region = mtk_region_create_rectangle (&stage_rect); unobscured_region = mtk_region_create_rectangle (&stage_rect);

View file

@ -527,11 +527,11 @@ apply_edge_resistance_to_each_side (MetaEdgeResistanceData *edge_data,
const gfloat tile_edges[] = const gfloat tile_edges[] =
{ {
1./4., 1.0f / 4.0f,
1./3., 1.0f / 3.0f,
1./2., 1.0f / 2.0f,
2./3., 2.0f / 3.0f,
3./4., 3.0f / 4.0f,
}; };
meta_window_get_work_area_current_monitor (window, &workarea); meta_window_get_work_area_current_monitor (window, &workarea);
@ -550,7 +550,7 @@ apply_edge_resistance_to_each_side (MetaEdgeResistanceData *edge_data,
*/ */
for (i = 0; i < G_N_ELEMENTS (tile_edges); i++) for (i = 0; i < G_N_ELEMENTS (tile_edges); i++)
{ {
guint horizontal_point = workarea.x + floor (workarea.width * tile_edges[i]); guint horizontal_point = workarea.x + (int) floorf (workarea.width * tile_edges[i]);
if (ABS (horizontal_point - new_left) < 16) if (ABS (horizontal_point - new_left) < 16)
{ {

View file

@ -450,7 +450,7 @@ setup_pipeline (MetaBackgroundContent *self,
cogl_pipeline_set_uniform_1f (self->pipeline, cogl_pipeline_set_uniform_1f (self->pipeline,
cogl_pipeline_get_uniform_location (self->pipeline, cogl_pipeline_get_uniform_location (self->pipeline,
"vignette_sharpness"), "vignette_sharpness"),
self->vignette_sharpness); (float) self->vignette_sharpness);
self->changed &= ~CHANGED_VIGNETTE_PARAMETERS; self->changed &= ~CHANGED_VIGNETTE_PARAMETERS;
} }
@ -462,7 +462,8 @@ setup_pipeline (MetaBackgroundContent *self,
meta_display_get_monitor_geometry (self->display, meta_display_get_monitor_geometry (self->display,
self->monitor, &monitor_geometry); self->monitor, &monitor_geometry);
gradient_height_perc = MAX (0.0001, self->gradient_height / (float)monitor_geometry.height); gradient_height_perc = MAX (0.0001f,
self->gradient_height / (float) monitor_geometry.height);
cogl_pipeline_set_uniform_1f (self->pipeline, cogl_pipeline_set_uniform_1f (self->pipeline,
cogl_pipeline_get_uniform_location (self->pipeline, cogl_pipeline_get_uniform_location (self->pipeline,
"gradient_height_perc"), "gradient_height_perc"),
@ -470,7 +471,7 @@ setup_pipeline (MetaBackgroundContent *self,
cogl_pipeline_set_uniform_1f (self->pipeline, cogl_pipeline_set_uniform_1f (self->pipeline,
cogl_pipeline_get_uniform_location (self->pipeline, cogl_pipeline_get_uniform_location (self->pipeline,
"gradient_max_darkness"), "gradient_max_darkness"),
self->gradient_max_darkness); (float) self->gradient_max_darkness);
self->changed &= ~CHANGED_GRADIENT_PARAMETERS; self->changed &= ~CHANGED_GRADIENT_PARAMETERS;
} }
@ -483,7 +484,7 @@ setup_pipeline (MetaBackgroundContent *self,
monitor_scale = meta_backend_is_stage_views_scaled (backend) monitor_scale = meta_backend_is_stage_views_scaled (backend)
? meta_display_get_monitor_scale (self->display, self->monitor) ? meta_display_get_monitor_scale (self->display, self->monitor)
: 1.0; : 1.0f;
if (self->rounded_clip_bounds_set) if (self->rounded_clip_bounds_set)
{ {
@ -535,15 +536,15 @@ setup_pipeline (MetaBackgroundContent *self,
} }
if (self->vignette) if (self->vignette)
color_component = self->vignette_brightness * opacity / 255.; color_component = (float) (self->vignette_brightness * opacity / 255.0);
else else
color_component = opacity / 255.; color_component = opacity / 255.0f;
cogl_color_init_from_4f (&color, cogl_color_init_from_4f (&color,
color_component, color_component,
color_component, color_component,
color_component, color_component,
opacity / 255.); opacity / 255.0f);
cogl_pipeline_set_color (self->pipeline, &color); cogl_pipeline_set_color (self->pipeline, &color);
fb = clutter_paint_context_get_framebuffer (paint_context); fb = clutter_paint_context_get_framebuffer (paint_context);
@ -579,11 +580,11 @@ set_glsl_parameters (MetaBackgroundContent *self,
monitor_scale = meta_backend_is_stage_views_scaled (backend) monitor_scale = meta_backend_is_stage_views_scaled (backend)
? meta_display_get_monitor_scale (self->display, self->monitor) ? meta_display_get_monitor_scale (self->display, self->monitor)
: 1.0; : 1.0f;
float pixel_step[] = { float pixel_step[] = {
1.f / (self->texture_area.width * monitor_scale), 1.0f / (self->texture_area.width * monitor_scale),
1.f / (self->texture_area.height * monitor_scale), 1.0f / (self->texture_area.height * monitor_scale),
}; };
pixel_step_uniform_location = pixel_step_uniform_location =
@ -595,8 +596,8 @@ set_glsl_parameters (MetaBackgroundContent *self,
*/ */
scale[0] = self->texture_area.width / (float)actor_pixel_rect->width; scale[0] = self->texture_area.width / (float)actor_pixel_rect->width;
scale[1] = self->texture_area.height / (float)actor_pixel_rect->height; scale[1] = self->texture_area.height / (float)actor_pixel_rect->height;
offset[0] = self->texture_area.x / (float)actor_pixel_rect->width - 0.5; offset[0] = self->texture_area.x / (float)actor_pixel_rect->width - 0.5f;
offset[1] = self->texture_area.y / (float)actor_pixel_rect->height - 0.5; offset[1] = self->texture_area.y / (float)actor_pixel_rect->height - 0.5f;
cogl_pipeline_set_uniform_float (self->pipeline, cogl_pipeline_set_uniform_float (self->pipeline,
cogl_pipeline_get_uniform_location (self->pipeline, cogl_pipeline_get_uniform_location (self->pipeline,
@ -672,10 +673,10 @@ meta_background_content_paint_content (ClutterContent *content,
return; return;
clutter_actor_get_content_box (actor, &actor_box); clutter_actor_get_content_box (actor, &actor_box);
rect_within_actor.x = actor_box.x1; rect_within_actor.x = (int) actor_box.x1;
rect_within_actor.y = actor_box.y1; rect_within_actor.y = (int) actor_box.y1;
rect_within_actor.width = actor_box.x2 - actor_box.x1; rect_within_actor.width = (int) (actor_box.x2 - actor_box.x1);
rect_within_actor.height = actor_box.y2 - actor_box.y1; rect_within_actor.height = (int) (actor_box.y2 - actor_box.y1);
if (clutter_actor_is_in_clone_paint (actor)) if (clutter_actor_is_in_clone_paint (actor))
{ {
@ -686,14 +687,14 @@ meta_background_content_paint_content (ClutterContent *content,
clutter_actor_get_transformed_position (actor, clutter_actor_get_transformed_position (actor,
&transformed_x, &transformed_x,
&transformed_y); &transformed_y);
rect_within_stage.x = floorf (transformed_x); rect_within_stage.x = (int) floorf (transformed_x);
rect_within_stage.y = floorf (transformed_y); rect_within_stage.y = (int) floorf (transformed_y);
clutter_actor_get_transformed_size (actor, clutter_actor_get_transformed_size (actor,
&transformed_width, &transformed_width,
&transformed_height); &transformed_height);
rect_within_stage.width = ceilf (transformed_width); rect_within_stage.width = (int) ceilf (transformed_width);
rect_within_stage.height = ceilf (transformed_height); rect_within_stage.height = (int) ceilf (transformed_height);
untransformed = untransformed =
rect_within_actor.x == rect_within_stage.x && rect_within_actor.x == rect_within_stage.x &&

View file

@ -408,10 +408,10 @@ get_texture_area (MetaBackground *self,
/* Start off by centering a tile in the middle of the /* Start off by centering a tile in the middle of the
* total screen area taking care of the monitor scaling. * total screen area taking care of the monitor scaling.
*/ */
image_area.x = (screen_width - texture_width) / 2.0; image_area.x = (int) ((screen_width - texture_width) / 2.0);
image_area.y = (screen_height - texture_height) / 2.0; image_area.y = (int) ((screen_height - texture_height) / 2.0);
image_area.width = texture_width; image_area.width = (int) texture_width;
image_area.height = texture_height; image_area.height = (int) texture_height;
/* Translate into the coordinate system of the particular monitor */ /* Translate into the coordinate system of the particular monitor */
image_area.x -= monitor_rect->x; image_area.x -= monitor_rect->x;
@ -422,8 +422,8 @@ get_texture_area (MetaBackground *self,
case G_DESKTOP_BACKGROUND_STYLE_CENTERED: case G_DESKTOP_BACKGROUND_STYLE_CENTERED:
/* paint region is the original image size centered in the actor, /* paint region is the original image size centered in the actor,
* and the texture is scaled to the original image size */ * and the texture is scaled to the original image size */
image_area.width = texture_width; image_area.width = (int) texture_width;
image_area.height = texture_height; image_area.height = (int) texture_height;
image_area.x = monitor_rect->width / 2 - image_area.width / 2; image_area.x = monitor_rect->width / 2 - image_area.width / 2;
image_area.y = monitor_rect->height / 2 - image_area.height / 2; image_area.y = monitor_rect->height / 2 - image_area.height / 2;
@ -447,7 +447,7 @@ get_texture_area (MetaBackground *self,
{ {
/* Fill image to exactly fit actor horizontally */ /* Fill image to exactly fit actor horizontally */
image_area.width = monitor_rect->width; image_area.width = monitor_rect->width;
image_area.height = texture_height * monitor_x_scale; image_area.height = (int) (texture_height * monitor_x_scale);
/* Position image centered vertically in actor */ /* Position image centered vertically in actor */
image_area.x = 0; image_area.x = 0;
@ -456,7 +456,7 @@ get_texture_area (MetaBackground *self,
else else
{ {
/* Scale image to exactly fit actor vertically */ /* Scale image to exactly fit actor vertically */
image_area.width = texture_width * monitor_y_scale; image_area.width = (int) (texture_width * monitor_y_scale);
image_area.height = monitor_rect->height; image_area.height = monitor_rect->height;
/* Position image centered horizontally in actor */ /* Position image centered horizontally in actor */
@ -475,8 +475,8 @@ get_texture_area (MetaBackground *self,
meta_display_get_size (self->display, &screen_width, &screen_height); meta_display_get_size (self->display, &screen_width, &screen_height);
/* unclipped texture area is whole screen, scaled depending on monitor */ /* unclipped texture area is whole screen, scaled depending on monitor */
image_area.width = screen_width * monitor_scale; image_area.width = (int) (screen_width * monitor_scale);
image_area.height = screen_height * monitor_scale; image_area.height = (int) (screen_height * monitor_scale);
/* But make (0,0) line up with the appropriate monitor */ /* But make (0,0) line up with the appropriate monitor */
image_area.x = -monitor_rect->x; image_area.x = -monitor_rect->x;
@ -808,8 +808,8 @@ meta_background_get_texture (MetaBackground *self,
if (meta_backend_is_stage_views_scaled (backend)) if (meta_backend_is_stage_views_scaled (backend))
{ {
texture_width = monitor_area.width * monitor_scale; texture_width = (int) (monitor_area.width * monitor_scale);
texture_height = monitor_area.height * monitor_scale; texture_height = (int) (monitor_area.height * monitor_scale);
} }
else else
{ {
@ -831,10 +831,10 @@ meta_background_get_texture (MetaBackground *self,
if (self->style != G_DESKTOP_BACKGROUND_STYLE_WALLPAPER) if (self->style != G_DESKTOP_BACKGROUND_STYLE_WALLPAPER)
{ {
monitor_area.x *= monitor_scale; monitor_area.x = (int) (monitor_area.x * monitor_scale);
monitor_area.y *= monitor_scale; monitor_area.y = (int) (monitor_area.y * monitor_scale);
monitor_area.width *= monitor_scale; monitor_area.width = (int) (monitor_area.width * monitor_scale);
monitor_area.height *= monitor_scale; monitor_area.height = (int) (monitor_area.height * monitor_scale);
} }
if (!cogl_framebuffer_allocate (monitor->fbo, &catch_error)) if (!cogl_framebuffer_allocate (monitor->fbo, &catch_error))
@ -851,9 +851,12 @@ meta_background_get_texture (MetaBackground *self,
} }
cogl_framebuffer_orthographic (monitor->fbo, 0, 0, cogl_framebuffer_orthographic (monitor->fbo, 0, 0,
monitor_area.width, monitor_area.height, -1., 1.); monitor_area.width,
monitor_area.height,
-1.0f,
1.0f);
if (texture2 != NULL && self->blend_factor != 0.0) if (texture2 != NULL && self->blend_factor != 0.0f)
{ {
CoglPipeline *pipeline = create_pipeline (PIPELINE_REPLACE); CoglPipeline *pipeline = create_pipeline (PIPELINE_REPLACE);
int mipmap_level; int mipmap_level;
@ -1007,7 +1010,7 @@ meta_background_set_blend (MetaBackground *self,
set_file (self, &self->file1, &self->background_image1, file1, FALSE); set_file (self, &self->file1, &self->background_image1, file1, FALSE);
set_file (self, &self->file2, &self->background_image2, file2, FALSE); set_file (self, &self->file2, &self->background_image2, file2, FALSE);
self->blend_factor = blend_factor; self->blend_factor = (float) blend_factor;
self->style = style; self->style = style;
free_wallpaper_texture (self); free_wallpaper_texture (self);

View file

@ -186,9 +186,9 @@ meta_shadow_unref (MetaShadow *shadow)
* drawing. * drawing.
* *
* Paints the shadow at the given position, for the specified actual * Paints the shadow at the given position, for the specified actual
* size of the region. * size of the region.
* *
* Since a #MetaShadow can be shared between different sizes with * Since a #MetaShadow can be shared between different sizes with
* the same extracted [struct@Meta.WindowShape] the size needs to be passed in here. * the same extracted [struct@Meta.WindowShape] the size needs to be passed in here.
*/ */
void void
@ -216,8 +216,8 @@ meta_shadow_paint (MetaShadow *shadow,
return; return;
cogl_color_init_from_4f (&color, cogl_color_init_from_4f (&color,
opacity / 255.0, opacity / 255.0, opacity / 255.0f, opacity / 255.0f,
opacity / 255.0, opacity / 255.0); opacity / 255.0f, opacity / 255.0f);
cogl_pipeline_set_color (shadow->pipeline, &color); cogl_pipeline_set_color (shadow->pipeline, &color);
if (shadow->scale_width) if (shadow->scale_width)

View file

@ -161,8 +161,8 @@ update_size (MetaShapedTexture *stex)
} }
else if (stex->has_viewport_src_rect) else if (stex->has_viewport_src_rect)
{ {
dst_width = stex->viewport_src_rect.size.width; dst_width = (int) stex->viewport_src_rect.size.width;
dst_height = stex->viewport_src_rect.size.height; dst_height = (int) stex->viewport_src_rect.size.height;
} }
else else
{ {
@ -495,7 +495,7 @@ get_opaque_overlay_pipeline (CoglContext *ctx)
if (!pipeline) if (!pipeline)
{ {
pipeline = cogl_pipeline_new (ctx); pipeline = cogl_pipeline_new (ctx);
cogl_color_init_from_4f (&color, 0.0, 0.2, 0.0, 0.2); cogl_color_init_from_4f (&color, 0.0f, 0.2f, 0.0f, 0.2f);
cogl_pipeline_set_color (pipeline, &color); cogl_pipeline_set_color (pipeline, &color);
cogl_context_set_named_pipeline (ctx, cogl_context_set_named_pipeline (ctx,
@ -517,7 +517,7 @@ get_blended_overlay_pipeline (CoglContext *ctx)
if (!pipeline) if (!pipeline)
{ {
pipeline = cogl_pipeline_new (ctx); pipeline = cogl_pipeline_new (ctx);
cogl_color_init_from_4f (&color, 0.2, 0.0, 0.2, 0.2); cogl_color_init_from_4f (&color, 0.2f, 0.0f, 0.2f, 0.2f);
cogl_pipeline_set_color (pipeline, &color); cogl_pipeline_set_color (pipeline, &color);
cogl_context_set_named_pipeline (ctx, cogl_context_set_named_pipeline (ctx,
@ -678,8 +678,10 @@ do_paint_content (MetaShapedTexture *stex,
if (stex->has_viewport_src_rect) if (stex->has_viewport_src_rect)
{ {
sample_width = stex->viewport_src_rect.size.width * stex->buffer_scale; sample_width = (int) (stex->viewport_src_rect.size.width *
sample_height = stex->viewport_src_rect.size.height * stex->buffer_scale; stex->buffer_scale);
sample_height = (int) (stex->viewport_src_rect.size.height *
stex->buffer_scale);
} }
else else
{ {
@ -846,8 +848,8 @@ do_paint_content (MetaShapedTexture *stex,
cogl_pipeline_set_layer_filters (blended_pipeline, i, min_filter, mag_filter); cogl_pipeline_set_layer_filters (blended_pipeline, i, min_filter, mag_filter);
} }
cogl_color_init_from_4f (&color, opacity / 255.0, opacity / 255.0, cogl_color_init_from_4f (&color, opacity / 255.0f, opacity / 255.0f,
opacity / 255.0, opacity / 255.0); opacity / 255.0f, opacity / 255.0f);
cogl_pipeline_set_color (blended_pipeline, &color); cogl_pipeline_set_color (blended_pipeline, &color);
if (blended_tex_region) if (blended_tex_region)
@ -1113,8 +1115,8 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
.size.width = dst_width, .size.width = dst_width,
.size.height = dst_height .size.height = dst_height
}; };
inverted_dst_width = ceilf (viewport.size.width); inverted_dst_width = (int) ceilf (viewport.size.width);
inverted_dst_height = ceilf (viewport.size.height); inverted_dst_height = (int) ceilf (viewport.size.height);
mtk_rectangle_crop_and_scale (clip, mtk_rectangle_crop_and_scale (clip,
&inverted_viewport, &inverted_viewport,
@ -1269,7 +1271,7 @@ meta_shaped_texture_is_opaque (MetaShapedTexture *stex)
meta_shaped_texture_ensure_size_valid (stex); meta_shaped_texture_ensure_size_valid (stex);
return mtk_rectangle_equal (&opaque_rect, return mtk_rectangle_equal (&opaque_rect,
&MTK_RECTANGLE_INIT (0, 0, &MTK_RECTANGLE_INIT (0, 0,
stex->dst_width, stex->dst_height)); stex->dst_width, stex->dst_height));
} }

View file

@ -136,8 +136,8 @@ set_unobscured_region (MetaSurfaceActor *surface_actor,
&width, &width,
&height); &height);
bounds = (MtkRectangle) { bounds = (MtkRectangle) {
.width = width, .width = (int) width,
.height = height, .height = (int) height,
}; };
priv->unobscured_region = mtk_region_copy (unobscured_region); priv->unobscured_region = mtk_region_copy (unobscured_region);

View file

@ -287,8 +287,8 @@ calculate_background_cull_region (MetaWindowActorWayland *self)
rect = (MtkRectangle) { rect = (MtkRectangle) {
.x = 0, .x = 0,
.y = 0, .y = 0,
.width = clutter_actor_get_width (self->background) * geometry_scale, .width = (int) (clutter_actor_get_width (self->background) * geometry_scale),
.height = clutter_actor_get_height (self->background) * geometry_scale, .height = (int) (clutter_actor_get_height (self->background) * geometry_scale),
}; };
return mtk_region_create_rectangle (&rect); return mtk_region_create_rectangle (&rect);

View file

@ -1240,8 +1240,8 @@ meta_window_actor_get_buffer_bounds (MetaScreenCastWindow *screen_cast_window,
stex = meta_surface_actor_get_texture (priv->surface); stex = meta_surface_actor_get_texture (priv->surface);
*bounds = (MtkRectangle) { *bounds = (MtkRectangle) {
.width = floorf (meta_shaped_texture_get_unscaled_width (stex)), .width = (int) floorf (meta_shaped_texture_get_unscaled_width (stex)),
.height = floorf (meta_shaped_texture_get_unscaled_height (stex)), .height = (int) floorf (meta_shaped_texture_get_unscaled_height (stex)),
}; };
} }
@ -1588,8 +1588,8 @@ create_framebuffer_from_window_actor (MetaWindowActor *self,
resource_scale = clutter_actor_get_resource_scale (actor); resource_scale = clutter_actor_get_resource_scale (actor);
texture = cogl_texture_2d_new_with_size (cogl_context, texture = cogl_texture_2d_new_with_size (cogl_context,
clip->width * resource_scale, (int) (clip->width * resource_scale),
clip->height * resource_scale); (int) (clip->height * resource_scale));
if (!texture) if (!texture)
return NULL; return NULL;
@ -1689,10 +1689,10 @@ meta_window_actor_get_image (MetaWindowActor *self,
goto out; goto out;
framebuffer_clip = (MtkRectangle) { framebuffer_clip = (MtkRectangle) {
.x = floorf (x), .x = (int) floorf (x),
.y = floorf (y), .y = (int) floorf (y),
.width = ceilf (width), .width = (int) ceilf (width),
.height = ceilf (height), .height = (int) ceilf (height),
}; };
if (clip) if (clip)
@ -1701,8 +1701,8 @@ meta_window_actor_get_image (MetaWindowActor *self,
MtkRectangle intersected_clip; MtkRectangle intersected_clip;
tmp_clip = *clip; tmp_clip = *clip;
tmp_clip.x += floorf (x); tmp_clip.x += (int) floorf (x);
tmp_clip.y += floorf (y); tmp_clip.y += (int) floorf (y);
if (!mtk_rectangle_intersect (&framebuffer_clip, if (!mtk_rectangle_intersect (&framebuffer_clip,
&tmp_clip, &tmp_clip,
&intersected_clip)) &intersected_clip))
@ -1719,14 +1719,14 @@ meta_window_actor_get_image (MetaWindowActor *self,
resource_scale = clutter_actor_get_resource_scale (actor); resource_scale = clutter_actor_get_resource_scale (actor);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
framebuffer_clip.width * (int) (framebuffer_clip.width *
resource_scale, resource_scale),
framebuffer_clip.height * (int) (framebuffer_clip.height *
resource_scale); resource_scale));
cogl_framebuffer_read_pixels (framebuffer, cogl_framebuffer_read_pixels (framebuffer,
0, 0, 0, 0,
framebuffer_clip.width * resource_scale, (int) (framebuffer_clip.width * resource_scale),
framebuffer_clip.height * resource_scale, (int) (framebuffer_clip.height * resource_scale),
COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT, COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT,
cairo_image_surface_get_data (surface)); cairo_image_surface_get_data (surface));
@ -1775,10 +1775,10 @@ meta_window_actor_paint_to_content (MetaWindowActor *self,
goto out; goto out;
framebuffer_clip = (MtkRectangle) { framebuffer_clip = (MtkRectangle) {
.x = floorf (x), .x = (int) floorf (x),
.y = floorf (y), .y = (int) floorf (y),
.width = ceilf (width), .width = (int) ceilf (width),
.height = ceilf (height), .height = (int) ceilf (height),
}; };
if (clip) if (clip)

View file

@ -1207,8 +1207,8 @@ update_move (MetaWindowDrag *window_drag,
dy = y - window_drag->anchor_root_y; dy = y - window_drag->anchor_root_y;
meta_window_get_frame_rect (window, &frame_rect); meta_window_get_frame_rect (window, &frame_rect);
new_x = x - (frame_rect.width * window_drag->anchor_rel_x); new_x = (int) (x - (frame_rect.width * window_drag->anchor_rel_x));
new_y = y - (frame_rect.height * window_drag->anchor_rel_y); new_y = (int) (y - (frame_rect.height * window_drag->anchor_rel_y));
meta_verbose ("x,y = %d,%d anchor ptr %d,%d rel anchor pos %f,%f dx,dy %d,%d", meta_verbose ("x,y = %d,%d anchor ptr %d,%d rel anchor pos %f,%f dx,dy %d,%d",
x, y, x, y,
@ -1269,7 +1269,8 @@ update_move (MetaWindowDrag *window_drag,
((double) (x - window_drag->initial_window_pos.x)) / ((double) (x - window_drag->initial_window_pos.x)) /
((double) window_drag->initial_window_pos.width); ((double) window_drag->initial_window_pos.width);
window_drag->initial_window_pos.x = x - window->saved_rect.width * prop; window_drag->initial_window_pos.x =
(int) (x - window->saved_rect.width * prop);
/* If we started dragging the window from above the top of the window, /* If we started dragging the window from above the top of the window,
* pretend like we started dragging from the middle of the titlebar * pretend like we started dragging from the middle of the titlebar
@ -1634,7 +1635,7 @@ end_grab_op (MetaWindowDrag *window_drag,
clutter_event_get_coords (event, &x, &y); clutter_event_get_coords (event, &x, &y);
modifiers = clutter_event_get_state (event); modifiers = clutter_event_get_state (event);
check_threshold_reached (window_drag, x, y); check_threshold_reached (window_drag, (int) x, (int) y);
/* If the user was snap moving then ignore the button /* If the user was snap moving then ignore the button
* release because they may have let go of shift before * release because they may have let go of shift before
@ -1658,14 +1659,14 @@ end_grab_op (MetaWindowDrag *window_drag,
if (window_drag->preview_tile_mode != META_TILE_NONE) if (window_drag->preview_tile_mode != META_TILE_NONE)
meta_window_tile (window, window_drag->preview_tile_mode); meta_window_tile (window, window_drag->preview_tile_mode);
else else
update_move (window_drag, flags, x, y); update_move (window_drag, flags, (int) x, (int) y);
} }
else if (meta_grab_op_is_resizing (window_drag->grab_op)) else if (meta_grab_op_is_resizing (window_drag->grab_op))
{ {
if (window->tile_match != NULL) if (window->tile_match != NULL)
flags |= (META_EDGE_RESISTANCE_SNAP | META_EDGE_RESISTANCE_WINDOWS); flags |= (META_EDGE_RESISTANCE_SNAP | META_EDGE_RESISTANCE_WINDOWS);
update_resize (window_drag, flags, x, y); update_resize (window_drag, flags, (int) x, (int) y);
maybe_maximize_tiled_window (window); maybe_maximize_tiled_window (window);
} }
} }
@ -1730,17 +1731,17 @@ process_pointer_event (MetaWindowDrag *window_drag,
if (modifier_state & CLUTTER_CONTROL_MASK) if (modifier_state & CLUTTER_CONTROL_MASK)
flags |= META_EDGE_RESISTANCE_WINDOWS; flags |= META_EDGE_RESISTANCE_WINDOWS;
check_threshold_reached (window_drag, x, y); check_threshold_reached (window_drag, (int) x, (int) y);
if (meta_grab_op_is_moving (window_drag->grab_op)) if (meta_grab_op_is_moving (window_drag->grab_op))
{ {
queue_update_move (window_drag, flags, x, y); queue_update_move (window_drag, flags, (int) x, (int) y);
} }
else if (meta_grab_op_is_resizing (window_drag->grab_op)) else if (meta_grab_op_is_resizing (window_drag->grab_op))
{ {
if (window->tile_match != NULL) if (window->tile_match != NULL)
flags |= (META_EDGE_RESISTANCE_SNAP | META_EDGE_RESISTANCE_WINDOWS); flags |= (META_EDGE_RESISTANCE_SNAP | META_EDGE_RESISTANCE_WINDOWS);
queue_update_resize (window_drag, flags, x, y); queue_update_resize (window_drag, flags, (int) x, (int) y);
} }
break; break;
case CLUTTER_TOUCH_CANCEL: case CLUTTER_TOUCH_CANCEL:
@ -1789,8 +1790,8 @@ meta_window_drag_begin (MetaWindowDrag *window_drag,
} }
else if (window_drag->pos_hint_set) else if (window_drag->pos_hint_set)
{ {
root_x = window_drag->pos_hint.x; root_x = (int) window_drag->pos_hint.x;
root_y = window_drag->pos_hint.y; root_y = (int) window_drag->pos_hint.y;
} }
else else
{ {
@ -1799,8 +1800,8 @@ meta_window_drag_begin (MetaWindowDrag *window_drag,
graphene_point_t pos; graphene_point_t pos;
clutter_seat_query_state (seat, device, sequence, &pos, NULL); clutter_seat_query_state (seat, device, sequence, &pos, NULL);
root_x = pos.x; root_x = (int) pos.x;
root_y = pos.y; root_y = (int) pos.y;
} }
meta_topic (META_DEBUG_WINDOW_OPS, meta_topic (META_DEBUG_WINDOW_OPS,

View file

@ -614,15 +614,15 @@ place_window_if_needed(MetaWindow *window,
*/ */
if (info->current.width >= info->work_area_monitor.width) if (info->current.width >= info->work_area_monitor.width)
{ {
info->current.width = .75 * info->work_area_monitor.width; info->current.width = (int) (0.75f * info->work_area_monitor.width);
info->current.x = info->work_area_monitor.x + info->current.x = (int) (info->work_area_monitor.x +
.125 * info->work_area_monitor.width; 0.125f * info->work_area_monitor.width);
} }
if (info->current.height >= info->work_area_monitor.height) if (info->current.height >= info->work_area_monitor.height)
{ {
info->current.height = .75 * info->work_area_monitor.height; info->current.height = (int) (0.75f * info->work_area_monitor.height);
info->current.y = info->work_area_monitor.y + info->current.y = (int) (info->work_area_monitor.y +
.083 * info->work_area_monitor.height; 0.083f * info->work_area_monitor.height);
} }
/* idle_move_resize() uses the unconstrained_rect, so make sure it /* idle_move_resize() uses the unconstrained_rect, so make sure it
@ -1576,13 +1576,13 @@ constrain_aspect_ratio (MetaWindow *window,
case META_GRAVITY_WEST: case META_GRAVITY_WEST:
case META_GRAVITY_EAST: case META_GRAVITY_EAST:
/* Yeah, I suck for doing implicit rounding -- sue me */ /* Yeah, I suck for doing implicit rounding -- sue me */
new_height = CLAMP (new_height, new_width / maxr, new_width / minr); new_height = (int) CLAMP (new_height, new_width / maxr, new_width / minr);
break; break;
case META_GRAVITY_NORTH: case META_GRAVITY_NORTH:
case META_GRAVITY_SOUTH: case META_GRAVITY_SOUTH:
/* Yeah, I suck for doing implicit rounding -- sue me */ /* Yeah, I suck for doing implicit rounding -- sue me */
new_width = CLAMP (new_width, new_height * minr, new_height * maxr); new_width = (int) CLAMP (new_width, new_height * minr, new_height * maxr);
break; break;
case META_GRAVITY_NORTH_WEST: case META_GRAVITY_NORTH_WEST:
@ -1609,9 +1609,8 @@ constrain_aspect_ratio (MetaWindow *window,
new_width, new_height, new_width, new_height,
&best_width, &best_height); &best_width, &best_height);
/* Yeah, I suck for doing implicit rounding -- sue me */ new_width = (int) best_width;
new_width = best_width; new_height = (int) best_height;
new_height = best_height;
break; break;
} }

View file

@ -417,7 +417,7 @@ meta_display_class_init (MetaDisplayClass *klass)
* @message: (allow-none): The message to display, or %NULL * @message: (allow-none): The message to display, or %NULL
* to clear a previous restart message. * to clear a previous restart message.
* *
* The signal will be emitted to indicate that the compositor * The signal will be emitted to indicate that the compositor
* should show a message during restart. * should show a message during restart.
* *
* This is emitted when [func@Meta.restart] is called, either by Mutter * This is emitted when [func@Meta.restart] is called, either by Mutter
@ -1734,7 +1734,7 @@ root_cursor_prepare_at (MetaCursorSpriteXcursor *sprite_xcursor,
meta_cursor_sprite_xcursor_set_theme_scale (sprite_xcursor, meta_cursor_sprite_xcursor_set_theme_scale (sprite_xcursor,
(int) ceiled_scale); (int) ceiled_scale);
meta_cursor_sprite_set_texture_scale (cursor_sprite, meta_cursor_sprite_set_texture_scale (cursor_sprite,
1.0 / ceiled_scale); 1.0f / ceiled_scale);
} }
} }
else else
@ -1750,8 +1750,8 @@ root_cursor_prepare_at (MetaCursorSpriteXcursor *sprite_xcursor,
if (logical_monitor) if (logical_monitor)
{ {
meta_cursor_sprite_xcursor_set_theme_scale (sprite_xcursor, meta_cursor_sprite_xcursor_set_theme_scale (sprite_xcursor,
logical_monitor->scale); (int) logical_monitor->scale);
meta_cursor_sprite_set_texture_scale (cursor_sprite, 1.0); meta_cursor_sprite_set_texture_scale (cursor_sprite, 1.0f);
} }
} }
} }
@ -3878,8 +3878,8 @@ focus_on_pointer_rest_callback (gpointer data)
if ((int) point.x != focus_data->pointer_x || if ((int) point.x != focus_data->pointer_x ||
(int) point.y != focus_data->pointer_y) (int) point.y != focus_data->pointer_y)
{ {
focus_data->pointer_x = point.x; focus_data->pointer_x = (int) point.x;
focus_data->pointer_y = point.y; focus_data->pointer_y = (int) point.y;
return G_SOURCE_CONTINUE; return G_SOURCE_CONTINUE;
} }

Some files were not shown because too many files have changed in this diff Show more