1
0
Fork 0

boxes: Add 'round' rounding strategy

It just calls roundf(), and is intended to be used when the graphene
rectangle is approximately integer aligned.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1042
This commit is contained in:
Jonas Ådahl 2020-01-15 19:27:54 +01:00
parent 7f6cafa847
commit a11f9bd513
2 changed files with 10 additions and 0 deletions

View file

@ -45,6 +45,7 @@ typedef enum _MetaRoundingStrategy
{
META_ROUNDING_STRATEGY_SHRINK,
META_ROUNDING_STRATEGY_GROW,
META_ROUNDING_STRATEGY_ROUND,
} MetaRoundingStrategy;
/* Output functions -- note that the output buffer had better be big enough:

View file

@ -2151,6 +2151,15 @@ meta_rectangle_from_graphene_rect (const graphene_rect_t *rect,
};
}
break;
case META_ROUNDING_STRATEGY_ROUND:
{
*dest = (MetaRectangle) {
.x = roundf (rect->origin.x),
.y = roundf (rect->origin.y),
.width = roundf (rect->size.width),
.height = roundf (rect->size.height),
};
}
}
}