[mutter] boxes: Crop rectangle converting to integer with grow strategy
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] boxes: Crop rectangle converting to integer with grow strategy
- Date: Fri, 1 Mar 2019 18:52:24 +0000 (UTC)
commit 8b09542fd912b2d97ff9ad1d86ce6f576e67cb69
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Fri Mar 1 02:58:13 2019 +0100
boxes: Crop rectangle converting to integer with grow strategy
Reuse meta_rectangle_from_clutter_rect with growing strategy to properly cast
the clutter floating rectangle to integer MetaRectangle.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
src/core/boxes.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/core/boxes.c b/src/core/boxes.c
index 7b693e1b1..4ab07d273 100644
--- a/src/core/boxes.c
+++ b/src/core/boxes.c
@@ -2191,10 +2191,13 @@ meta_rectangle_crop_and_scale (const MetaRectangle *rect,
int dst_height,
MetaRectangle *dest)
{
- dest->x = floorf (rect->x * (src_rect->size.width / dst_width) +
- src_rect->origin.x);
- dest->y = floorf (rect->y * (src_rect->size.height / dst_height) +
- src_rect->origin.y);
- dest->width = ceilf (rect->width * (src_rect->size.width / dst_width));
- dest->height = ceilf (rect->height * (src_rect->size.height / dst_height));
+ ClutterRect tmp = CLUTTER_RECT_INIT (rect->x, rect->y,
+ rect->width, rect->height);
+
+ clutter_rect_scale (&tmp,
+ src_rect->size.width / dst_width,
+ src_rect->size.height / dst_height);
+ clutter_rect_offset (&tmp, src_rect->origin.x, src_rect->origin.y);
+
+ meta_rectangle_from_clutter_rect (&tmp, META_ROUNDING_STRATEGY_GROW, dest);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]