cursor-sprite: Use early exits when invalidating
To make the code easier to follow. While on it, use `G_APPROX_VALUE` where appropriate. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4093>
This commit is contained in:
parent
1bb53f06cf
commit
72ac8c6987
@ -130,10 +130,11 @@ meta_cursor_sprite_set_texture_scale (MetaCursorSprite *sprite,
|
||||
MetaCursorSpritePrivate *priv =
|
||||
meta_cursor_sprite_get_instance_private (sprite);
|
||||
|
||||
if (priv->texture_scale != scale)
|
||||
meta_cursor_sprite_invalidate (sprite);
|
||||
if (G_APPROX_VALUE (priv->texture_scale, scale, FLT_EPSILON))
|
||||
return;
|
||||
|
||||
priv->texture_scale = scale;
|
||||
meta_cursor_sprite_invalidate (sprite);
|
||||
}
|
||||
|
||||
void
|
||||
@ -143,10 +144,11 @@ meta_cursor_sprite_set_texture_transform (MetaCursorSprite *sprite,
|
||||
MetaCursorSpritePrivate *priv =
|
||||
meta_cursor_sprite_get_instance_private (sprite);
|
||||
|
||||
if (priv->texture_transform != transform)
|
||||
meta_cursor_sprite_invalidate (sprite);
|
||||
if (priv->texture_transform == transform)
|
||||
return;
|
||||
|
||||
priv->texture_transform = transform;
|
||||
meta_cursor_sprite_invalidate (sprite);
|
||||
}
|
||||
|
||||
CoglTexture *
|
||||
|
Loading…
x
Reference in New Issue
Block a user